spring-messaging-demo
Companion code for the messaging series on ankurm.com. Each directory is a
self-contained Maven project for one article, with its own pom.xml, its own numbered
documentation chapters, and its own captured output under docs/output/ — regenerated by that
module's scripts/run-all.sh, never typed by hand.
| Module | Article | What it demonstrates |
|---|---|---|
kafka-basics/ |
Spring Boot 4.1 and Apache Kafka: Producer, Consumer and Serialisation from Scratch | The on-ramp: what the starter gives you, the two Jackson serializer families, where a key lands and why, and which defaults are Kafka's rather than Spring's |
rabbitmq/ |
Spring Boot and RabbitMQ: Exchanges, Queues, Bindings and a Working Dead-Letter Queue | All four exchange types against a real broker, manual acknowledgement, and a dead-letter path exercised through both rejection and TTL expiry |
The two brokers make an instructive pair. Kafka's consumer holds an offset and the broker remembers nothing about individual records; RabbitMQ's broker owns the message until it is acknowledged and can route, expire and dead-letter it on its own. Almost every difference in how you handle failure follows from that one sentence — which is why Kafka needs a retry topic to do what RabbitMQ does with a queue argument.
They are meant to be read in order. kafka-basics establishes that the default acknowledgement
mode is BATCH and therefore that delivery is at-least-once; everything the error-handling
module does exists because of that one sentence.
Common ground
All modules target the same verified stack: JDK 25 (Temurin 25.0.4.1+1), Spring Boot
4.1.1, Spring Framework 7.0.9. Versions were read from maven-metadata.xml on Maven
Central and from Boot's own spring-boot-dependencies POM, rather than from release
announcements.
Every module runs its broker without Docker, so the transcripts can be regenerated on any
machine with a JDK: Kafka via the in-process KRaft broker in spring-kafka-test, RabbitMQ via a
real broker started by the module's own scripts. Each module also ships a Testcontainers
configuration for the cases where the deployed image is what you need to test against.
Licence
MIT — see LICENSE.