Build Reliable Microservice Communication
When your services need to communicate reliably and in real time, event-driven architecture delivers. This starter project gets you up and running quickly.
The Problem
Building event-driven microservices with Java Spring Boot and Kafka requires configuring multiple components: producer factories, consumer factories, Kafka templates, listener containers, serializers, and topics. The Spring documentation is extensive but overwhelming for getting started quickly.
The Solution
This complete working example provides two Java Spring Boot services communicating via Kafka:
- Infrastructure - Docker Compose with Kafka and Zookeeper
- Producer Service - Spring Boot app publishing events
- Consumer Service - Spring Boot app receiving events
- Configuration Classes - Properly structured beans and properties
- IntelliJ Ready - Import and run immediately
The Benefits
- Save 20-30 hours of Spring Kafka configuration
- Best practices from real production implementations
- Maven builds - Standard tooling
- IDE support - Works in IntelliJ, Eclipse, VS Code
- Extensible - Add your own event types and handlers
Project Structure
code/
docker-compose.yml
producer/
ProducerApplication.java
ProducerConfiguration.java
KafkaProducer.java
application.properties
consumer/
ConsumerApplication.java
ConsumerConfiguration.java
KafkaConsumer.java
application.properties
Technical Highlights
- @EnableScheduling for periodic event generation
- KafkaTemplate for message sending
- @KafkaListener for message reception
- TopicBuilder for topic management
- Proper serializer configuration
What You Get
Complete Maven project with both services, Docker infrastructure, and full documentation. From download to running events in under 10 minutes.
Ready to build reliable, scalable microservices.