Start a single node Redpanda cluster with Docker Compose by running:
docker compose up -d
You can find the Spring Boot Kafka client application inside spring-kafka-example
directory. Run the main class is com.redpanda.samples.springkafka.Application
. It will create the orders
topic in Redpanda upon startup.
Send a perfect JSON message:
docker exec -it redpanda rpk topic produce orders
{ "id":2, "amount":65.49}
This will log the message payload in the Spring application console.
Send a malformed JSON message:
docker exec -it redpanda rpk topic produce orders
{ "id":3, "amount":99.99
This will be routed to the orders-dlt
topic, which is the dead letter topic in this scenario.
Simulate a transient error by sending an order with id set to 1. This will be retried in the orders-retry
topic.
docker exec -it redpanda rpk topic produce orders
{ "id":1, "amount":12.49}
docker compose down