Messaging

In application development terms, messaging, which is also commonly known as message-oriented middleware, or just middleware, refers to technology that lets computer systems share information without requiring direct connections, or awareness of one another's location.

Messaging is analogous to postal and shipping services. Just as you would hand your letters or packages to a carrier and trust that they will get to where you want them to go; so it is with messaging, applications hand off information to a messaging system that routes it to whatever applications, analytics engines, or user interfaces you’ve said you want it to get to. The analogy holds up fairly well when you consider different kinds of shipping and qualities-of-service (first class vs. bulk mail, ground vs. overnight, local vs. overseas, and so on) as different kinds of messaging are used for different kinds of interactions, such as publish/subscribe, request/reply, and others that we'll take a look at in the sections that follow.

What does a message look like? Fundamentally, a message has three parts: Header, Properties, and Body.

Header

The header is the part of the message used by the event broker for routing messages through the system. Some header fields, such as Destination and Delivery Mode, are required, while others are optional. For example, the reply-to topic is optional, and is only needed for Request-Reply messaging, where the Replier needs to know where to send its responses.

Properties

In addition to the header fields, application-specific properties can also be included as part of the message. These application-specified properties are unmodified by the event broker, and can be used to facilitate communication between applications. Some APIs define their own standard properties. For instance, JMS has defined properties such as JMSXUserID and JMSXAppID which can be used to identify the user or application sending the message. Besides API-defined standard properties, applications can also specify properties. An example of an application-specified property might be an Order ID an Order Management System uses as a unique identifier to track all messages related to a given purchase.

Body

The body of a message is often called the payload, or the attachment. It contains data in an application-specified format, and is transported unmodified by the event broker. The body is made up of raw binary data, or structured data such as text, streams, maps, or otherwise. Regardless, Producers and Consumer must agree upon the payload format so that the data can be properly interpreted.