Skip to content
Prev Previous commit
Next Next commit
doc
  • Loading branch information
apuig committed Mar 26, 2025
commit 2d06abfc5c80c6d0e60fcf1bc52481b3e16eae37
60 changes: 60 additions & 0 deletions ARQUITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
```mermaid

sequenceDiagram
box Data Consolidation
participant ConsolidationService
end

participant SegmentClient
box HTTP
participant QueueHttp
participant LooperHttp
participant SegmentAPI
end
box File
participant QueueFile
participant WriteFile
participant File
participant WatchFile
end

activate ConsolidationService
ConsolidationService->>+SegmentClient: enqueue
SegmentClient<<->>QueueHttp: offer
alt QueueHttp overflow
SegmentClient<<->>QueueFile: put
end
SegmentClient->>-ConsolidationService:
deactivate ConsolidationService

loop consume QueueHttp
LooperHttp->>QueueHttp:take
activate LooperHttp
end
LooperHttp->>SegmentAPI: batchUpload
note over LooperHttp,SegmentAPI: Batch
note over LooperHttp,SegmentAPI: CircuitBreaker and Retry
note over LooperHttp,SegmentAPI: HTTP requests submited to a pool
deactivate LooperHttp

alt retry exhausted or circuit open
note over LooperHttp: pool threads
LooperHttp->>QueueFile: put
end

loop consume QueueFile
WriteFile->>QueueFile:take
activate WriteFile
end
WriteFile->>File: write
note over WriteFile: Batch and save file
deactivate WriteFile

note over WatchFile: check last written
activate WatchFile
loop watch QueueFile
WatchFile->>File: read and remove
WatchFile->>QueueHttp: offer
end
deactivate WatchFile
```