Created
June 5, 2025 18:59
-
-
Save danieldfc/d1729b66b6cb4191b45faf5a3cd89d63 to your computer and use it in GitHub Desktop.
EventCatalog - Evento Rocketseat - Microserviços
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Olá, gostaria de ressaltar que tentei fazer no EventCatalog, mas não consegui reproduzir, aqui está uma ideia do que construí. | |
Os domínios que separei foi o Streaming e o Analytics, visando que se deixar junto, pode ocasionar em problemas no processamento do vídeo. | |
# Domínio Streaming | |
--- | |
id: streaming | |
name: Streaming | |
version: 1.0.0 | |
summary: | | |
Domínio responsável pela emissão de eventos relacionados à reprodução de vídeo. | |
owners: | |
- danielfelizardo | |
services: | |
- id: PlaybackService | |
version: 1.0.0 | |
--- | |
## Serviço: PlaybackService | |
--- | |
type: service | |
name: PlaybackService | |
domain: streaming | |
version: 1.0.0 | |
owners: | |
- danielfelizardo | |
produces: | |
- VideoStarted | |
- VideoPaused | |
- VideoStopped | |
consumes: [] | |
summary: Serviço responsável por emitir eventos de reprodução de vídeos. | |
--- | |
## Events | |
### VideoStarted | |
--- | |
type: event | |
name: VideoStarted | |
domain: streaming | |
version: 1.0.0 | |
producer: PlaybackService | |
consumers: | |
- AnalyticsService | |
kafka: | |
topic: video.started | |
--- | |
Payload | |
{ | |
"videoId": "9f1f0cf2-5c17-4286-bfce-4b08474672be", | |
"userId": "97927cc9-f11b-477b-8433-a677e2f5dc76", | |
"timestamp": "2025-06-05T18:49:50.239Z", | |
"device": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36" | |
} | |
### VideoPaused | |
--- | |
type: event | |
name: VideoPaused | |
domain: streaming | |
version: 1.0.0 | |
producer: PlaybackService | |
consumers: | |
- AnalyticsService | |
kafka: | |
topic: video.paused | |
--- | |
Payload | |
{ | |
"videoId": "9f1f0cf2-5c17-4286-bfce-4b08474672be", | |
"userId": "97927cc9-f11b-477b-8433-a677e2f5dc76", | |
"timestamp": "2025-06-05T18:49:50.239Z", | |
"position": 167000 | |
} | |
### VideoStopped | |
--- | |
type: event | |
name: VideoStopped | |
domain: streaming | |
version: 1.0.0 | |
producer: PlaybackService | |
consumers: | |
- AnalyticsService | |
kafka: | |
topic: video.stopped | |
--- | |
Payload | |
{ | |
"videoId": "9f1f0cf2-5c17-4286-bfce-4b08474672be", | |
"userId": "97927cc9-f11b-477b-8433-a677e2f5dc76", | |
"timestamp": "2025-06-05T18:49:50.239Z", | |
"durationWatched": 192000 | |
} | |
# Domínio Analytics | |
--- | |
id: analytics | |
name: Analytics | |
version: 1.0.0 | |
summary: | | |
Domínio responsável por consumir eventos de reprodução para fins de análise e métricas. | |
owners: | |
- danielfelizardo | |
services: | |
- id: AnalyticsService | |
version: 1.0.0 | |
--- | |
## Service: AnalyticsService | |
--- | |
type: service | |
name: AnalyticsService | |
domain: analytics | |
version: 1.0.0 | |
owners: | |
- danielfelizardo | |
produces: [] | |
consumes: | |
- VideoStarted | |
- VideoPaused | |
- VideoStopped | |
summary: Serviço que consome eventos de reprodução para gerar análises e métricas. | |
--- | |
# Ilustração | |
Para deixar ainda mais estruturado e que seja exemplificado de maneira mais humanizada, este é um diagrama de sequencia dos passos a serem explorados. | |
```nermaid | |
sequenceDiagram | |
participant User | |
participant PlaybackService | |
participant Kafka | |
participant AnalyticsService | |
User->>PlaybackService: Play, Pause, Stop | |
PlaybackService->>Kafka: Emite eventos | |
Kafka->>AnalyticsService: Entrega eventos para análise | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment