O'Reilly logo

Just Spring Integration by Madhusudhan Konda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Messages

Messages are the objects that carry information between two applications. They are constructed at one end, usually the producer side of the messaging application. They are then consumed and deconstructed at the other end, the consumer/subscriber side. Think of the message as an object that carries business data, such a new Account or Trade information. The publisher/producer creates these objects and publishes them to a channel. A subscriber/consumer connected to the same channel then receives those messages. The domain objects are then resurrected from these messages, and business processing is carried out.

Dissecting a Message

The Message consists of two parts—the payload and header properties.

Imagine a greeting card arriving in your mailbox on your birthday. The card inside the envelope may be called the payload. Payload is the data or the information that has to be processed by the interested parties. The greeting card also has some additional information—the sender’s and receiver’s addresses, first- or second-class delivery, and possibly instructions such as “Handle with Care.” Such additional pieces of information are header properties.

The payload and header properties are represented as a Message interface in Spring Integration, as shown below:

public interface Message<T> {
  T getPayLoad();
  MessageHeaders getHeaders();
}

Figure 2-1 depicts the TradeMessage composition.

Figure 2-1. Message Composition

From the above definition of a Message, you can set any Plain Old Java ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required