Idan Fridman

About Idan Fridman

Idan is Software engineer with experience in Server side technologies. Idan is responsible for various infrastructure models in the software industry(Telecommunications, Finance).

Spring Integration key notes with real life scenarios

This post will summarize Spring Integration (SI) important key notes together with messaging Integration patterns. For each key note I will add a real life example based on my experience.

Splitter

a. What it does?

The Splitter is actually a pattern which receives one message in one point and split it into several.

b. Why is it good for me?

The Splitter can be used when you want to split your content into multiple parts. Each part will process the content asynchronously.

c. Real life example

In trading systems you can have a trading-request. The request suppose to be executed following a couple of steps: (execute it against a provider, logging it in the DB, send notification to the client)

With Splitter you can do all at once.

d. SI example:

<int:splitter id="tradeSplitter" input-channel="tradeSplitterInputChannel" output-channel="outPutChannel">

Router

a. What it does?

The Router is a mechanism when a message being received in one point and by a content based criteria it will dispatch to a specific destination.

b. Why is it good for me?

The router is very handy when you actually have different message inputs that need to be handled  differently based on their content.

c. Real life example

So you have a notification feature in your infrastructure. Each client chose to be noticed differently (Email, Sms, Fax, Webservice,  etc..). Notification request being sent to the client and based on the request content the router will choose to which component the request will be handed: EmailService, SmscService, FaxService and so on..

d. SI example:

router id="notificationsRouter" input-channel="notificationInputChannel"

Aggregator

a. What it does?

The Aggregator role is to wait for a group of related messages. After all expected messages retrieved it will be able to merge them and send a single out result. The Aggregator able to handle different group messages simultaneity by a group correlation Id.

b. Why is it good for me?

Usually the Aggregators works together with a Splitter. After you splitting your request to multiple destinations parallel you might need to aggregate all destinations results and send final result as an output.

c. Real life example

In trading systems you get different prices from different providers. It’s very often to choose the best price among all providers. The Aggregator will be able to aggregate all prices and send back the best one.

d. SI example:

<int:aggregator input-channel="bestPriceAgg" output-channel="bestPriceChannel"
send-partial-result-on-expiry="true">
</int:aggregator>

Filter

a. What it does?

In short: “Do you want to get this message?”

b. Why is it good for me?

Your component might get different messages. Instead of processing unnecessary messages you could filter the messages based on the message payload ( In the EJB world it’s very similar to Message Driven Bean Selectors).

c. Real life example:

In the trading system world you could choose whether the commission in the final price should be included or not. Your component role is to add commissions only to the clients which wish for it. That component via filter will receive only the prices which are commission based.

d. SI example:

<filter input-channel="commisionsChannel" ref="selector" output-channel="output"/>

Transformer

a. What it does?

The transformer can receive a message and convert it’s payload from one type to another.

b. Why is it good for me?

You could have convert your message format from one to another based on your destination.

b. Why is it good for me?

Many times we receiving input in one format and we need to parse or convert them to other format after adding/modifying/deleting the payload content ( For example from XML into String and vice versa).

c. Real life example

So you have an order request. That request need to be placed in DB in a specific format, After that it needs to be sent over to the client within an xml format. You could transform the payload to fit your destination needs.

d. SI example:

<object-to-string-transformer input-channel="in" output-channel="out"/>

There are  additional components in SI. Those are the most popular ones.
 

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


× two = 6



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close