Introducing the booking service
In this section, we will start by implementing a publish/subscribe architecture using RabbitMQ. For this, we will need new microservices to our architecture—the booking service will handle bookings for events. Its responsibilities will include making sure that events are not overbooked. For this, it will need to know about existing events and locations. In order to achieve this, we will modify the EventService to emit events whenever a location or an event was created (yes, the terminology is confusing—make sure not to mistake the notification that something has happened kind-of-event with the Metallica is playing here kind-of-event). The BookingService can then listen to these events and emit events itself whenever someone books a ticket for one of these events.
An overview of our microservices and the events that they will be publishing and subscribing to