What is a message?
A message
is a communication asset used to transmit or exchange information from a sender to the receiver through channels
. A single message
can be consumed by multiple independent receivers and can also be defined as an event or command. The sender includes a payload of data (that has been serialized into an appropriate format, e.g., JSON, XML, binary, etc.) that needs to be processed by the receiver. It may also include metadata; information that describes the message itself. This metadata is often known as headers or properties.
In the diagram above, the sender application transmits a message
to the receiver application.
Messages vs Events
A message
carries information from one application to the other, while an event
is a message that provides details of something that has already occurred. One important aspect to note is that depending on the type of information a message
contains, it can fall under an event, query, or command.
See the diagram below.
Overall, events
are messages
but not all messages
are events
.