Messages

Introduction

  • A wrapper around the data which the sender wants to send.
  • it is a format which is understandable by every component of the messaging system
  • it is the moving component in the messaging system

Message structure

  • It is the metadata of the message. 
  • The sender can use the header to send any information that is related to the message but not part of the payload.
  • Such information can be :
    • Message ID: A unique ID of each message. works as an idempotent ID.
    • Correlation ID (Trace ID): useful to trace a request across services.
    • Message Group ID: useful in the grouping of the messages. 
    • Sequence Number: useful in the ordering of the messages.
    • Expiry Time: tells when the message will expire.
    • Creation Time: tells when the message was created.

Payload

  • The actual piece of data which is intended to be transferred.
  • Based on the intent of the data, the payload can be categorized into 3 types
    • Action: The intent is to ask the receiver to perform some action like CREATE_SHIPMENT or GET_ORDER.
    • Event: The intent is to notify about an event that happened like ORDER_CREATED.
    • Document: The intent is to pass the data of either event or entity.