A proof-of-concept distributed ad click event processing system built using Spring Boot and an AWS-style event-driven architecture (emulated locally using LocalStack).
This project simulates a real-world ad-tech click processing pipeline where user ad clicks are ingested via a REST API, published to a message queue, processed asynchronously by a consumer, deduplicated using Redis, and persisted in PostgreSQL.
It demonstrates key distributed systems concepts such as:
- Event-driven architecture
- Asynchronous processing
- Idempotency and deduplication
- Message queues (AWS SQS via LocalStack)
- Multi-service modular design
click-api
|
| (REST API)
v
SQS Queue (LocalStack)
|
v
click-consumer
|
+--> Redis (deduplication)
|
+--> PostgreSQL (persistence)
- Java: 21
- Build Tool: Maven (multi-module)
- Framework: Spring Boot 3.2.x
- Message Queue: AWS SQS (LocalStack)
- Cache: Redis
- Database: PostgreSQL
- Containerization: Docker & Docker Compose
- Testing: JUnit 5 (optional extension)
ad-event-click-processor/
├── pom.xml # Parent Maven project
├── common/ # Shared models (DTOs)
├── click-api/ # REST API service (event producer)
├── click-consumer/ # Async consumer service
Contains shared domain objects such as:
- ClickEvent
Responsible for:
- Accepting click events via REST API
- Publishing events to SQS queue
Responsible for:
- Consuming events from SQS
- Deduplicating events using Redis
- Persisting processed events into PostgreSQL
- Java 21+
- Maven 3.8+
- Docker & Docker Compose
Start required dependencies:
docker-compose up -dThis starts:
- LocalStack (SQS)
- Redis
- PostgreSQL
mvn clean installRun API service:
mvn spring-boot:run -pl click-apiRun Consumer service:
mvn spring-boot:run -pl click-consumerPOST /api/v1/clicks{
"adId": "AD-123",
"userId": "USER-456"
}- REST-based event ingestion
- Asynchronous processing via SQS
- Redis-based deduplication (idempotency)
- PostgreSQL persistence of processed events
- Multi-module Maven architecture
- Local AWS simulation using LocalStack
- Dead Letter Queue (DLQ)
- Retry mechanisms
- Metrics & monitoring (Prometheus/Grafana)
- Load testing generator
- Kubernetes deployment
- Distributed tracing
This project is a POC and is provided as-is.