Consonance is a robust event processing system built in Go that demonstrates the integration of Apache Kafka and Temporal for reliable, scalable event processing. It provides a framework for consuming, processing, and producing events with built-in workflow management and error handling.
Consonance combines several powerful technologies to create a reliable event processing pipeline:
- π Apache Kafka: Handles event streaming and provides persistent message queues
- βοΈ Temporal: Manages workflow orchestration and provides reliable task execution
- π Go API Server: Provides HTTP endpoints for workflow management
- Raw events are published to
example.raw.events
Kafka topic - Temporal workflows coordinate the processing of events in configurable batches
- Processed events are published to
example.processed.events
- Any processing errors are captured in the
example.errors
topic
- π§ Go 1.23.6 or later
- π³ Docker and Docker Compose
- βοΈ Make (optional, but recommended)
-
Clone the repository:
git clone https://github.com/yourusername/consonance.git cd consonance
-
Start the infrastructure:
make start-infra
This will start Kafka, Temporal, and their dependencies.
-
Start the application:
make start-app
The following services will be available:
- π API Server: http://localhost:8082
- π Kafka UI: http://localhost:8081
- β‘ Temporal UI: http://localhost:8080
GET /health
POST /api/v1/workflows
Content-Type: application/json
{
"batch_size": 10,
"processing_interval": "30s"
}
GET /api/v1/workflows/{workflowID}
.
βββ docker/
β βββ docker-compose.yml # Infrastructure setup
βββ internal/
β βββ api/ # HTTP API implementation
β βββ kafka/ # Kafka initialization and utilities
β βββ orchestration/ # Temporal workflows and activities
βββ scripts/ # Utility scripts
βββ main.go # Application entry point
-
Format your code:
go fmt ./...
-
Run tests:
go test ./...
make start-infra
: Start infrastructure componentsmake start-app
: Start the applicationmake logs
: View logs from all servicesmake down
: Stop all servicesmake clean
: Clean up everything including volumes
Configuration is managed through YAML files:
kafka.yml
: Kafka topic configurationdocker-compose.yml
: Infrastructure service configuration
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- β‘ Temporal for workflow orchestration
- π Apache Kafka for event streaming
- π Chi Router for HTTP routing