Member-only story
Simple Pub-Sub implementation with Spring Boot, Docker, and RabbitMQ
How to set up a simple pub-sub with manual acknowledgment
6 min readFeb 8, 2021
In this tutorial, I want to show you how you can easily set up RabbitMQ with docker and integrate it into your Spring application to easily implement a pub-sub procedure.
Note: In order to follow this tutorial, you should have some basic knowledge in setting up a Spring Boot application and know how to run a Docker container.
Publish-Subscribe-Pattern
First, let’s start with some quick fundamentals about the Publish-Subscribe-Pattern. The pattern is very simple but powerful. The following image shows the main concept:
We have two actors in this pattern:
- Publisher: Asynchronously sends messages to the queue without worrying about who exactly processes the respective message.
- Subscriber: Subscribes to specific topics or a specific queue and consumes incoming messages.