Featured image for โ€œSpring Integration With JMSโ€

Spring Integration With JMS

October 6, 2015


Attention: This article was published over 10 years ago, and the information provided may be aged or outdated. While some topics are evergreen, technology moves fast, so please keep that in mind as you read the post.

What is Spring Integration?

The popular definition (via Google), JavaWorld.com says: โ€œSpring Integrationย is an enterprise integrationย framework that provides out-of-the-box implementation of the patterns in the now-classic Enterpriseย Integrationย Patternsโ€ฆโ€

Spring.io defines it as: โ€œSpring Integration enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adaptersโ€

If you are a Spring Integration pro, this article may not be for you, as Iโ€™m still relatively new to the material myself. ย This is only intended to be an elementary example of the simplest form with regards to Spring Integration and JMSย queues.

Regardless of all that pre-posturing,ย perhapsย you mayย find some articulations that can help you to bridge the gap in your development effort!

An Example

After some flailing about and trying to attach meaning to the flood of terminology, I came to the following conclusion: In my very limited (JMS-based) world, the most basic example I needed was reduced to 3 pieces, connected in the following way:ย  Adapter –> Channel –> Service

In a sense, Spring Integration is much like sending a child to school…

spring integration

The Adapter resembles the parent, gettingย theย child ready for school; A lot of tedious preparation work to prepare for the journey ahead. (For the sake of simplicity, I’ve tried to keep this example is very concise, but do not be surprised to see your configurations significantly inflate.)

For my project, that meant implementing aย HeaderMapper for the Message Driven Channel Adapter, so that I couldย retain the original JMSย queue name (called the JMSDestination) in the MessageHeaders for use later in the Service Adapter.

The channel, resembling the school bus, is mostly just a transport pipe, offeringย very few options, seemingly intended to decouple the different endpoints from one another. (It still breaks my heart every time I see them off to school! #sniff)

The Service Activator is the journeys (potential) end with Spring Integration, and begins with the actual business requirements of your project.

Hopefully, this was an easy to follow, and light example of Spring Integration, and you are now or soon to be,ย up and running in a Spring Integration test or better!

Sample XML

Below is a sample of XML you might find useful for getting set up with your first application:
xml

(Click the graphic for a link to the source!)

— Ryan McCullough, [email protected]

About The Author

More From Ryan McCullough

About Keyhole Software

Expert team of software developer consultants solving complex software challenges for U.S. clients.

Share This Post

Related Posts


Discuss This Article

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments