Spring Book – Chapter 20 – Spring Integration

Main Components

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
  • 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).

Message

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

Figure 22-1. A typical message consisting of multiple message header and a payload

Message Channel

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

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

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: 13345

The following two tabs change content below.
Tomcy John

Tomcy John

Blogger & Author at javacodebook
He is an Enterprise Java Specialist holding a degree in Engineering (B-Tech) with over 10 years of experience in several industries. He's currently working as Principal Architect at Emirates Group IT since 2005. Prior to this he has worked with Oracle Corporation and Ernst & Young. His main specialization is on various web technologies and acts as chief mentor and Architect to facilitate incorporating Spring as Corporate Standard in the organization.
Tomcy John

Latest posts by Tomcy John (see all)

2 thoughts on “Spring Book – Chapter 20 – Spring Integration

  1. Hi,
    Thanks for this blog and information sharing!
    I have one question from Spring Integration. Just thought of checking with you.
    I have SimplewebserviceOutBoundGateway. I need to send a document / attachment to the webservice. How will i achieve that?
    This is my current gateway configuration:

    Please let me know, if you can throw some light in this area.
    Thanks in Advance!

  2. Hi,
    Thank you for your information sharing.
    I have one doubt,could you please suggest me the correct frameworks to address that issue.

    My requirement is I would like to get and process files using spring and camel.

    Thanks,
    Madhu

Leave a Reply

Your email address will not be published. Required fields are marked *