Tag Archives: spring integration

Spring Book – Chapter 20 – Spring Integration

Any modern application does not live in isolation. To realize the business requirements it has to communicate with customers of varied types and other applications in variety of ways. Application integration lets your application do this and in modern day applications, this is crucial for any application. Spring Integration aids in application integration that lets applications share data and services with each other making it connect with varied kind of users.

The Spring Integration is an open-source; simple integration framework that leverages the capabilities of widely adopted Spring Framework making application integration easy and simpler to implement.

This Chapter will help you start with Spring Integration and will aid you in achieving the various integration requirement in your application. I am sure after reading through this Chapter you will have one more weapon up your sleeves which you can use and reap benefits from its high level of integration capabilities.

Spring Integration Goals and Principles

Spring Integration is motivated by the following goals:

  • Provide a simple model for implementing complex enterprise integration solutions.
  • Facilitate asynchronous, message-driven behavior within a Spring-based application.
  • Promote intuitive, incremental adoption for existing Spring users.

Spring Integration is guided by the following principles:

  • Components should be loosely coupled for modularity and testability.
  • The framework should enforce separation of concerns between business logic and integration logic.
  • Extension points should be abstract in nature but within well-defined boundaries to promote reuse and portability.

The goals and principles of Spring Integration is as quoted in the Spring Integration Reference Manual.

Spring Integration Benefits

Spring Integration benefits can be summarized as follows:

  • Loose coupling between components – brings about development of small and focused components that caters to specific role and responsibility. This eases testing and promotes reuse largely.
  • Helps to separate integration and processing logic – Spring Integration pitches-in, handling message routing, transformation etc. and eases the application developer from this. Due to high level of configuration based integration style, easily processing can be switched between synchronous and asynchronous with no change in the code that is handy in this ever-changing business application scenario.
  • Promotes Event-driven architecture – No hard coded process flows and capability to easily change and expend these flows according to application requirement. Single word that can be used is adaptability.

Enterprise Integration Pattern (EIP)

Enterprise Integration Patterns is a book by Gregor Hohpe and Bobby Woolf and describes a number of design patterns for the use of enterprise application integration and message-oriented middleware. Enterprise Integration Patterns can be implemented without coding using Spring Integration or Apache Camel.

Enterprise application integration is an integration framework composed of a collection of technologies and services, which form a middleware to enable integration of systems and applications across the enterprise.

– wikipedia.org

Spring Integration brings the power of Dependency Injection (DI) that Spring Framework is well known for and EIP patterns implementation together to nicely manage the resources and lets you focus on business logic rather than messaging infrastructure code.

Spring Integration Namespaces

For easing the various integration style configurations, Spring Integration has dedicated namespaces for each of them. Table 22-1 gives details of Spring Integration namespace in a tabular form for easy reading and understanding.

Table 22-1. Spring Integration namespaces

Namespace URL Prefix Description
http://www.springframework.org/schema/integration int Main schema
http://www.springframework.org/schema/integration/file file Defines the configuration elements for Spring Integration File Adapters.
http://www.springframework.org/schema/integration/ftp ftp Defines the configuration elements for Spring Integration FTP Adapters.
http://www.springframework.org/schema/integration/http http Defines the configuration elements for Spring Integration’s HTTP adapters.
http://www.springframework.org/schema/integration/httpinvoker httpinvoker Defines the configuration elements for Spring Integration’s HttpInvoker adapters. NOTE: The http-invoker support is deprecated as of 2.0.x. It is recommended to use the REST-based HTTP adapters instead.
http://www.springframework.org/schema/integration/xml xml Defines the configuration elements for Spring Integration’s XML support.
http://www.springframework.org/schema/integration/jms jms Defines the configuration elements for Spring Integration’s JMS adapters.
http://www.springframework.org/schema/integration/ip ip Defines the configuration elements for Spring Integration’s IP adapters.
http://www.springframework.org/schema/integration/xmpp xmpp
http://www.springframework.org/schema/integration/twitter twitter
http://www.springframework.org/schema/integration/event event Defines the configuration elements for Spring Integration Event Adapters.
http://www.springframework.org/schema/integration/gemfire gemfire Defines the core configuration elements for Spring Integration GemFire Support.
http://www.springframework.org/schema/integration/groovy groovy
http://www.springframework.org/schema/integration/jdbc jdbc Defines the configuration elements for Spring Integration’s JDBC components.
http://www.springframework.org/schema/integration/jmx jmx Defines the configuration elements for Spring Integration’s JMX adapters.
http://www.springframework.org/schema/integration/mail mail Defines the configuration elements for Spring Integration’s Mail Channel Adapters.
http://www.springframework.org/schema/integration/redis redis Defines the configuration elements for Spring Integration Redis Adapters and Channels.
http://www.springframework.org/schema/integration/rmi rmi Defines the configuration elements for Spring Integration’s RMI adapters.
http://www.springframework.org/schema/integration/security security
http://www.springframework.org/schema/integration/sftp sftp Defines the configuration elements for Spring Integration SFTP Adapters.
http://www.springframework.org/schema/integration/stream stream Defines the configuration elements for Spring Integration Stream-based Channel Adapters.
http://www.springframework.org/schema/integration/ws ws Defines the configuration elements for Spring Integration’s Web Service adapters.

Page Visitors: 9654

Spring Integration Vs. Apache Camel

The debate on which integration technology to use namely Spring Integration versus Apache Camel is one of the prominent topic now a days similar to mobile web application versus native mobile apps.

I don’t have any bias towards either Camel or Spring but for judgmental reasons I wanted to know which one to choose when given a chance in one of my projects. While doing so I did good amount of net surfing, and this blog post is an effort from my end to consolidate all the points that I could see in the internet. I have indeed plagiarized certain very good points from various blogs while doing so and some of the prominent blogs I have given as reference. Over the course of time I will be updating the blog post with more details as and when I find time.

Note: – I still haven’t been able to find an answer to my question and I am still using both co-jointly in my application. When using a connector I still don’t have a clear picture whether to use Spring connector or Camel connector.

Apache Camel – is a powerful open source integration framework based on known Enterprise Integration Patterns.

Spring Integration – It provides an extension to the Spring Framework to support the well-known Enterprise Integration Patterns while using the principles of Spring programming model.

Apache Camel as well as Spring Integration provides a lightweight alternative to ESB (Enterprise Service Bus), focusing on the programming model in such a way that the developer spends less time with infrastructural boilerplate.



Comparison from ohloh.net for the two projects:-

  • Camel has a total connector counts of >130 in all which does outscore Spring Integration by a great deal with Spring Integration catching up with every release. +1 Camel
  • Both are using Apache License version 2.0 which states, you can do whatever you want with the code. +1 Camel +1 Spring Integration.
  • Both projects have good activity with good amount of commits from good amount of committers. Camel does have an edge though over the number of commits with respect to Spring Integration. +1 Camel
  • Both started in the year 2007. The effort put for building Camel outscores Spring Integration by large. The lines of code with respect to Camel also outscore Spring Integration by a large distance. +1 Camel for the features it has with respect to lines of code. +1 Spring Integration as code lines cannot be said as a plus point (sometimes less code can be more effective and non-buggy).
  • Vibrant response community of Camel does outscore Spring Integration by a great deal. Might be because of Camel’s focused approach on integration as opposed to Spring’s all in one approach. What it means that most of the problems you face using Camel can be solved quickly by Googling as opposed to Spring Integration. Also the amount of stuff available in the case of Camel does outscore Spring Integration by a great deal as well. + Camel
  • JIRA activity is healthy in the case of Camel as opposed to Spring Integration. Again I see this because of the focused approach of Camel as well as attributed to the vibrant community along with good amount of code lines as compared to Spring Integration. Healthy JIRA activity does mean that turnaround time for a bug is quick in the case of Camel as compared to Spring Integration. +1 Camel
  • CamelOne conference for Camel and none for Spring Integration. Again this can be attributed to non-focus nature of Spring Framework as a whole as compared to Camel. +1 Camel
  • Both has good amount of tooling support in the form of STS and Fuse IDE. +1 Camel +1 Spring Integration
  • Both have commercial support and good amount of 3rd party consultants who are ready to help if you have more money to shell. +1 Camel +1 Spring Integration
  • Camel supports other DSL’s (Domain Specification Language) to a greater extend as compared with Spring Integration (ease of use and learn). +1 Camel

There is a very good presentation from Kai Wähner (Twitter: @KaiWaehner), which he presented in CamelOne Conference 2012, which does cover good amount of points and below is the slideshare details which he has shared. A well-documented comparison between various integration options available today on the Java (JVM) Platform. The author has played it safe similar to me by not giving a final verdict, but it will definitely help you to take into considerations and according to your application requirement take a right choice.

Some conclusions which can help the final decision:-

  • If you already have a Spring application which requires an integration layer, definitely Spring Integration is a good choice to make. If you have a non-spring application, using/introducing Camel as the integration layer would be really the way to go.

I don’t want to take any credit away from authors who has taken pain in doing this research. That’s the reason I would like to put the reference as the first section in my blog. I have gone through various blogs, tutorials and then compiled a blog in a focused and easy to understand manner.



One of the post from Mark Fisher will surely give an insight into the reason behind developing Spring Integration – http://www.coderanch.com/t/568364/Spring/Camel-Spring-Integration-Part


Page Visitors: 5127