Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Message Bus

C9 edited this page Jun 28, 2019 · 2 revisions

Service-to-service communication

It's all good and well to have a number of services, but these services are not isolated. There needs to be a way of communicating between them. This is where the message bus comes in.

The Message Bus

Just like Jop and Antonette, messages that services want to send to each other pass through our bus. Services register themselves with the bus, and tell the bus what message types they are listening for. The message bus will, when it receives a message, send it to all services that are listening for it. If no services are currently listening for the message, the bus keeps it in the queue, simplifying service startup by letting services start up concurrently and having the messages between them arrive when they have all been started, eliminating the need for complex dependency resolution.

Waiting for messages: request-response pairs

When two services are communicating, one service might want to wait for a message from another service while responding to a message. The message bus supports this behaviour through request-response pairs. As messages contain a UUID which uniquely identifies them, the message bus detects message types ending in 'request' which originate from a service and notes the service the request came from. When another service sends a message ending in 'response' which contains a response uuid, this uuid is matched with the request uuid table, and the response is sent to the service listening for it.

Clone this wiki locally