Spring Integration - Introduction

In this blog post and the subsequent post, I'm going to write about Spring Integration and also share my experience in using Spring Integration in a live project.

To begin with, I will provide a brief introduction to Spring Integration framework and in the next post I will show how to apply it.

Much of the content of this post is taken from the Spring Integration official website Spring Integration Reference

What is Spring Integration?

Spring Integration is a Spring driven framework which supports message driven architecture and provides routing, transformation of messages and implements the common Enterprise Integration patterns, more importantly the "Pipes and Filters" pattern.

What is Pipes and Filter Pattern?

This is an Enterprise Integration pattern, which is applied, if multiple processing units are required to process a message and we need to increase reuse and also achieve decoupling.

The "filters" represent any component that is capable of producing and/or consuming messages, and the "pipes" transport the messages between filters so that the components themselves remain loosely-coupled.

Components of Spring Integration Framework:

There are 3 main components (as in Pipes and Filter pattern):
  1. Message 
  2. Message Channel
  3. Message Endpoint

Message:




Generic wrapper for any Java object combined with metadata used by the framework while handling that object. In the header, any arbitrary key/value could be stored. In other words, any POJO could be used as a Message.

Message Channel:




A Message Channel represents the "pipe" of a pipes-and-filters architecture. Producers send Messages to a channel, and consumers receive Messages from a channel. The Message Channel therefore decouples the messaging components, and also provides a convenient point for interception and monitoring of Messages.

Types of channels:
  1. Point to Point: At most one consumer can receive each Message
  2. Publish/Subscribe: Broadcast each Message to all of its subscribers
Another category of channels:
  1. Pollable Channels: Are capable of buffering Messages within a queue
  2. SubscribableChannel: Iimplemented by channels that send Messages directly to their subscribed MessageHandlers
There are various implementations available for each of the above channel types. For eg, QueueChannel, DirectChannel etc. 

Message Endpoints:

A Message Endpoint represents the "filter" of a pipes-and-filters architecture. This is the processing unit which acts on the message.

Types of endpoint:

  1. Transformer: Responsible for converting a Message's content or structure and returning the modified Message
  2. Filter: Determines whether a Message should be passed to an output channel or not
  3. Router: Responsible for deciding what channel or channels should receive the Message next (if any).
  4. Splitter: Responsible for splitting a message into multiple messages and then send each of those to its output channel.
  5. Service Activator: A generic end point. We can configure a service provider and a service method with custom logic.
  6. Aggregator: Combines multiple messages into one (opposite of Splitter).
  7. Channel Adapter: Connects a Message Channel to some other system or transport.
Types of Channel Adapter:



  1. Inbound adapter: An inbound "Channel Adapter" endpoint connects a source system to a MessageChannel.
  2. Outbound adapter: An outbound "Channel Adapter" endpoint connects a MessageChannel to a target system.



Comments

  1. I generally check this kind of article and I found your article which is related to my interest. Genuinely it is good and instructive information, Enterprise Systems Thankful to you for sharing an article like this.

    ReplyDelete

Post a Comment

Popular posts from this blog

Pivotal Cloud Foundry (PCF) Integration with Elastic Cloud Storage (ECS)

Restful code example using Spring MVC

Spring Integration - Bulk processing Example