Azure Function Design Patern Advice - Peloton Cycle API > Google Fit API

Mike C 21 Reputation points
2021-01-29T22:11:20.977+00:00

My Problem:-
I want my Workout Logs from Peloton to find it's way into my Google Fit records. I've yet to find a pre-existing integration, the closest I've seen is a sync from Peloton > Stravia > Google Fit, however this only works for rides and I do floor work too and I'm keen not to have a middle man in my data.

Both Peloton and Google Fit have API access.

My Objective:-
I have started to pull together a C# library that can get the current data from Peloton, however I want to avoid duplicate entries being posted to Google Fit. What would be a good design for this approach. I have considered a Timer Function that exports all results from yesterday and posts to Google Fit but this seems a bit fragile and has 24hrs lag. My next thought was a Timer Function that runs frequently and uses some sort of state stored in a Blob to know what the last posted workout was, however I wondered if this would have issues if the function invocations overlapped?

Furthermore, I assume the correct approach would be different functions, one for the detection from Peloton and one for the Write to Google Fit, if I do this would durable functions be better/easier or should I use an intermediary queue?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,079 questions
0 comments No comments
{count} votes

Accepted answer
  1. Pramod Valavala 20,636 Reputation points Microsoft Employee
    2021-02-01T11:26:34.93+00:00

    Durable Functions would be a good fit for your scenario, allowing you to split processing into separate functions without having to deal with separate queues on your own.

    The Monitor Pattern would be the way to approach this to periodically synchronize data. And leverage Durable Entities to keep track of the last processed record.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.