Spring Integration provides a framework to build integration solutions which will facilitate your application communicating with other applications and services out there without which your application could live in isolation and won’t be of much use in modern day.
The main components in Spring Integration are:
- Message Channel
- Message Endpoint
In Spring Integration the data flows through a processing pipeline called as channels as a message and flows through various components called as endpoints. You can string together any number of channels and endpoints to realize your business case. We will see these components in detail in the following sections.
In other words Spring Integration can be defined as follows:
Spring Integration provides simple core API’s in which a “message” is sent by an “endpoint”. These endpoints are connected to each other using “message channels”. An “endpoint” receives messages from a “message channel” by subscribing (passive mode) or by polling (active mode).
A message consists of message header and a payload as shown in Figure 22-1 below. A message is considered as a package that can be used to transport via channels.
Message header is used to provide information to other components which consume these messages from appropriate channels. Some of the headers are pre-defined.
The payload is just a Java object and contains the actual data to be accessed or to be processed by the receiver.
Some of the information which can be given by accessing the message header details is as shown below:
- Sequence Number
- Sequence Size
- Expiration Date
- Correlation Identifier
- Return Address
- Transport Information
Figure 22-1. A typical message consisting of multiple message header and a payload
Its primary responsibility is to connect the messaging endpoints. It can also be optionally used for buffering and interception. In application integration, the message channel symbol is as shown in Figure 22-2 below.
Figure 22-2. Message Channel symbol used in enterprise integration
It decouples producers from consumers and is the central to loose coupling. Supports both Point-to-Point and Publish/Subscribe messaging types and can be pictorially represented as shown in Figure 22-3 below.
Figure 22-3. Producer and Consumer decoupled by the use of a message channel
The channel takes care of where and how the message is delivered but doesn’t interact with the actual payload of the message in anyway.
Page Visitors: 12162