From 5750050b6199856cd2bc230e1b0321918a82815f Mon Sep 17 00:00:00 2001 From: Bastiaan Date: Wed, 31 Jul 2024 13:38:41 +0200 Subject: [PATCH] Add sequence diagrams for operational flow to README.md --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 1119ef89..176f44c9 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,44 @@ docker-compose exec schema-registry-1 kafka-avro-console-consumer \ --topic connect_fitbit_intraday_heart_rate ``` +## Flows + +The following diagrams shows the flow of the Fitbit source connector. The fitbit source connector is a Kafka Connect source connector that polls the Fitbit API for data. The data is then converted to Avro records and sent to Kafka topics. + +### Initialization + +On startup, the fitbit connector simply starts up and schedules its regular polling tasks. + +```mermaid +sequenceDiagram + participant connector as Fitbit Source Connector + participant kafka as Kafka + + connector ->> kafka: Check Kafka readiness (optional) + connector ->> connector: Schedule polling tasks +``` + +### Regular operation + +The Fitbit connector operates by regularly polling the user repository, and regularly polling all configured users for data + +```mermaid +sequenceDiagram + participant connector as Fitbit Source Connector + participant userRepo as User Repository (rest-source-auth) + participant fitbit as Fitbit API + participant kafka as Kafka + + note over connector: Get users (every 5 minutes) + connector ->> userRepo: Get users @ /users?source-type=FitBit + note over connector: For each user (every 5 seconds) + connector ->> connector: What data should be fetched? + connector ->> userRepo: Get fitbit access token @ users//token + connector ->> fitbit: Get required data @ api.fitbit.com/1/user///date/ + connector ->> kafka: Send data + kafka ->> connector: 200 OK +``` + ## Contributing Code should be formatted using the [Google Java Code Style Guide](https://google.github.io/styleguide/javaguide.html).