Spring Integration Reference Guide
Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
Welcome to the Spring Integration reference documentation!
General project info, conventions
Features and changes made in the current version
Introduction to EIP and its implementation in the project
Main project abstractions and components
Details about the message abstraction implementations
main EIP components: router, splitter, aggregator, filter etc.
Transformer, content enricher, claim check, codec
Consumer endpoints, service activator, gateway, scripting, AOP aspects etc.
Details about Java DSL for EIP
Details about Groovy DSL for EIP
Details about Kotlin DSL for EIP
Message store, control bus, integration graph, metrics, JMX
Details about Reactive Streams support: message channels, channel adapters etc.
GraalVM native images and Spring AOT support
Protocol-specific channel adapters and gateways summary
AMQP channels, adapters and gateways
Apache Camel channel adapters and gateways
Apache Cassandra channel adapters
Handling and consuming Spring application events with channel adapters
RSS and Atom channel adapters
Channel adapters and gateways for file system support
Channel adapters and gateways for FTP protocol
Channel adapters for GraphQL
Channel adapters, gateways and utilities for Hazelcast
Channel adapters and gateways for HTTP communication
Channel adapters and gateways for JDBC, message and metadata stores
Channel adapters and gateways for JPA API
Channel adapters and gateways for JMS API
Channel adapters for JMX interaction, integration-specific MBean exporter
Channels, adapters and gateways for Apache Kafka
Channel adapters for Java Mail API
Channels, adapters, gateways and message store for MongoDb
Channel adapters for MQTT protocol
Channel adapters for R2DBC API
Channels, adapters, gateways and message store for Redis
Spring resource channel adapters
Channel adapters for RSocket protocol
Channel adapters and gateways for FTP protocol
Channel adapters and gateways for SMB protocol
Channel adapters and gateways for STOMP protocol
Channel adapters for Java IO stream API
Channel adapters for Syslog protocol
Channel adapters and gateways for TCP and UDP protocols
Channel adapters and gateways for WebFlux API
Channel adapters for WebSockets protocol
Channel adapters for SOAP protocol
Channel adapters and transformers for XML API, xPath
Channel adapters for XMPP protocol
Channels and adapters for ZeroMQ protocol
Channel adapters for Zookeeper and Curator API
Overview of error handling approaches in Spring Integration
Details about SpEL support
The Publisher annotation etc.
Overview of transactions support in Spring Integration
Securing Spring Integration flows
Messaging annotations, task scheduler, global properties, message mapping
Test utilities, Integration mocks and testing framework
The samples dedicated project
Other resources related to project
The changes made in the project over time
Spring Integration 6.1.2
Extends the Spring programming model to support the well-known Enterprise Integration Patterns. Spring Integration enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters. Those adapters provide a higher-level of abstraction over Spring’s support for remoting, messaging, and scheduling. Spring Integration’s primary goal is to provide a simple model for building enterprise integration solutions while maintaining the separation of concerns that is essential for producing maintainable, testable code.
Introduction
Using the Spring Framework encourages developers to code using interfaces and use dependency injection (DI) to provide a Plain Old Java Object (POJO) with the dependencies it needs to perform its tasks. Spring Integration takes this concept one step further, where POJOs are wired together using a messaging paradigm and individual components may not be aware of other components in the application. Such an application is built by assembling fine-grained reusable components to form a higher level of functionality. WIth careful design, these flows can be modularized and also reused at an even higher level.
In addition to wiring together fine-grained components, Spring Integration provides a wide selection of channel adapters and gateways to communicate with external systems. Channel Adapters are used for one-way integration (send or receive); gateways are used for request/reply scenarios (inbound or outbound). For a full list of adapters and gateways, refer to the reference documentation.
The Spring Cloud Stream project builds on Spring Integration, where Spring Integration is used as an engine for message-driven microservices.
Features
- Implementation of most of the Enterprise Integration Patterns
- Endpoint
- Channel (Point-to-point and Publish/Subscribe)
- Aggregator
- Filter
- Transformer
- Control Bus
- …
- Integration with External Systems
- ReST/HTTP
- FTP/SFTP
- STOMP
- WebServices (SOAP and ReST)
- TCP/UDP
- JMS
- RabbitMQ
- …
- The framework has extensive JMX support
- Exposing framework components as MBeans
- Adapters to obtain attributes from MBeans, invoke operations, send/receive notifications
Examples
In the following «quick start» application you can see that the same gateway interface is used to invoke two completely different service implementations. To build and run this program you will need the spring-integration-ws and spring-integration-xml modules as described above.
public interface TempConverter
And here is the same application (web service part) using the Java DSL (and Spring Boot). You will need the spring-boot-starter-integration dependency or spring-integration-core directly if you don’t use Spring Boot:
@SpringBootApplication public class Application < public static void main(String[] args) < ConfigurableApplicationContext ctx = SpringApplication.run(Application.class, args); TempConverter converter = ctx.getBean(TempConverter.class); System.out.println(converter.fahrenheitToCelcius(68.0f)); ctx.close(); >@MessagingGateway public interface TempConverter < @Gateway(requestChannel = "convert.input") float fahrenheitToCelcius(float fahren); >@Bean public IntegrationFlow convert() < return f ->f .transform(payload -> "" + "" + payload + " " + " ") .enrichHeaders(h -> h .header(WebServiceHeaders.SOAP_ACTION, "https://www.w3schools.com/xml/FahrenheitToCelsius")) .handle(new SimpleWebServiceOutboundGateway( "https://www.w3schools.com/xml/tempconvert.asmx")) .transform(Transformers.xpath("/*[local-name()=\"FahrenheitToCelsiusResponse\"]" + "/*[local-name()=\"FahrenheitToCelsiusResult\"]")); > >