liveBook · Manning

Message relay

As explained in Microservices Patterns, Second Edition

A software component that reads unpublished messages from an outbox and publishes them to a message broker.

A message relay moves unpublished messages from an outbox to a message broker. In a relational database setup, the service inserts messages into the outbox within the transaction that changes business objects, making both changes atomic. section 8.3.8

A polling relay follows this sequence:

  • Periodically query the outbox for unpublished messages. section 8.3.8
  • Publish each message to the broker’s destination channel, then delete it from the outbox. section 8.3.8
Figure 8.17 A service reliably publishes a message by inserting it into an OUTBOX table as part of the transaction that updates the database. The Message Relay reads the OUTBOX table and publishes the messages to a message broker.
ReliablePublication

Shows the service writing to the outbox within a database transaction and the relay publishing those messages to a broker. section 8.3.8

How Microservices Patterns, Second Edition covers it

How deep it goes
Details periodic outbox queries, broker publication, destination channels, and message deletion.
Examples
Uses a relational OUTBOX table and depicts a service publishing its messages to a broker.
What it assumes
Assumes a service stores messages in an outbox within the transaction that changes business objects.
What you can do after
Apply the polling flow by querying the outbox, publishing pending messages, and deleting them.
How it connects
Connects the transactional outbox and polling publisher with relational databases and message brokers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.