Asynchronous Integration with Messages

Explore the message types like integration events, commands, queries, and replies for communication between components, facilitating state changes, requests, and responses.

What exactly is a message?

So far, we have only talked about events, so what exactly is a message? An event is a message, but a message is not always an event. A message is a container with a payload, which can also be an event and can have some additional information in the form of key-value pairs.

A message can be used to communicate an event, but it can also be used to communicate an instruction or information to another component.

The kinds of payloads we will be using include the following:

  • Integration event: A state change that is communicated outside of its bounded context

  • Command: A request to perform work

  • Query: A request for some information

  • Reply: An informational response to either a command or query

Integration event

The first kind of message we will be introduced to and will implement is an integration event. The term integration event comes from how it is used to integrate domains and bounded contexts. This is how an integration event compares with the domain and event-sourced events we have already worked with:

Get hands-on with 1400+ tech skills courses.