How thanhphuchuynh/t-pubsub works
Main Components
• PubSub Service: The core component found in the pubsub directory. This includes the main service implementation (pubsub.go), batch consumer logic (batch_consumer.go), benchmarks, and reporting.
• Message Store and Data Models: Represented by the model directory (e.g., message.go) which details the immutable data structures for messages.
• Consumers and Batch Consumers: Show separate but connected components for individual message processing (consumer functions) and batch processing, as indicated by both pubsub and batch_consumer code.
• REST API Layer: Illustrate the API endpoints found in the README (endpoints for health, status, benchmark, simulation, and metrics) that interact with the core PubSub service.
• Monitoring & Metrics:
• Prometheus: As a separate component gathering metrics (configured by prometheus/prometheus.yml).
• Grafana: Dashboard visualization setup (grafana/dashboards and provisioning files).
• Docker & Deployment: Include Dockerfile, docker-compose.yml, and run.sh as components that encapsulate the runtime environment and deployment orchestration.
Relationships and Interactions
• From API calls coming into the PubSub Service that trigger message publishing and consumer invocation.
• From the message store to consumers and from batch consumers handling collections of messages.
• From the core service to the Metrics Registry then to Prometheus.
• From Prometheus feeding Grafana dashboards.
Architectural Patterns & Design Principles
• Functional Programming style:
• That the system returns new instances for operations rather than modifying state.
• REST API endpoints as interfaces for external interaction.
• That benchmarking and simulation are additional functionalities integrated into the system’s capabilities.