Spring Integration Reference Manual

Authors

Mark Fisher, Marius Bogoevici, Iwein Fuld, Jonas Partner, Oleg Zhurakousky, Gary Russell, Dave Syer, Josh Long, David Turanski, Gunnar Hillert, Artem Bilan, Amol Nayak

3.0.0.BUILD-SNAPSHOT


Table of Contents

Preface
1. Requirements
1.1. Compatible Java Versions
1.2. Compatible Versions of the Spring Framework
2. Code Conventions
I. What's new?
1. What's new in Spring Integration 3.0?
1.1. New Components
1.1.1. HTTP Request Mapping
1.1.2. Spring Expression Language (SpEL) Configuration
1.1.3. SpEL Functions Support
1.1.4. SpEL PropertyAccessors Support
1.1.5. Redis: New Components
1.1.6. Header Channel Registry
1.1.7. MongoDB support: New ConfigurableMongoDbMessageStore
1.1.8. Syslog Support
1.1.9. 'Tail' Support
1.1.10. JMX Support
1.1.11. TCP/IP Connection Events and Connection Management
1.1.12. Inbound Channel Adapter Script Support
1.1.13. Content Enricher: Headers Enrichment Support
1.2. General Changes
1.2.1. Message ID Generation
1.2.2. <gateway> Changes
1.2.3. HTTP Endpoint Changes
1.2.4. Jackson Support (JSON)
1.2.5. Chain Elements 'id' Attribute
1.2.6. Aggregator 'empty-group-min-timeout' property
1.2.7. Persistent File List Filters (file, (S)FTP)
1.2.8. Scripting Support: Variables Changes
1.2.9. Direct Channel Load Balancing configuration
1.2.10. PublishSubscribeChannel Behavior
1.2.11. FTP, SFTP and FTPS Changes
1.2.12. 'requires-reply' Attribute for Outbound Gateways
1.2.13. AMQP Outbound Gateway Header Mapping
1.2.14. Stored Procedure Components Improvements
1.2.15. Web Service Outbound URI Configuration
1.2.16. Redis Adapter Changes
1.2.17. Advising Filters
1.2.18. Advising Endpoints using Annotations
1.2.19. ObjectToStringTransformer Improvements
1.2.20. JPA Support Changes
1.2.21. Delayer: delay expression
1.2.22. JDBC Message Store Improvements
1.2.23. IMAP Idle Connection Exceptions
1.2.24. Message Headers and TCP
1.2.25. JMS Message Driven Channel Adapter
1.2.26. RMI Inbound Gateway
1.2.27. XsltPayloadTransformer
II. Overview of Spring Integration Framework
2. Spring Integration Overview
2.1. Background
2.2. Goals and Principles
2.3. Main Components
2.3.1. Message
2.3.2. Message Channel
2.3.3. Message Endpoint
2.4. Message Endpoints
2.4.1. Transformer
2.4.2. Filter
2.4.3. Router
2.4.4. Splitter
2.4.5. Aggregator
2.4.6. Service Activator
2.4.7. Channel Adapter
III. Core Messaging
3. Messaging Channels
3.1. Message Channels
3.1.1. The MessageChannel Interface
PollableChannel
SubscribableChannel
3.1.2. Message Channel Implementations
PublishSubscribeChannel
QueueChannel
PriorityChannel
RendezvousChannel
DirectChannel
ExecutorChannel
Scoped Channel
3.1.3. Channel Interceptors
3.1.4. MessagingTemplate
3.1.5. Configuring Message Channels
DirectChannel Configuration
Datatype Channel Configuration
QueueChannel Configuration
PublishSubscribeChannel Configuration
ExecutorChannel
PriorityChannel Configuration
RendezvousChannel Configuration
Scoped Channel Configuration
Channel Interceptor Configuration
Global Channel Interceptor
Wire Tap
Global Wire Tap Configuration
3.1.6. Special Channels
3.2. Poller (Polling Consumer)
3.3. Channel Adapter
3.3.1. Configuring An Inbound Channel Adapter
3.3.2. Configuring An Outbound Channel Adapter
3.3.3. Channel Adapter Expressions and Scripts
3.4. Messaging Bridge
3.4.1. Introduction
3.4.2. Configuring Bridge
4. Message Construction
4.1. Message
4.1.1. The Message Interface
4.1.2. Message Headers
Message ID Generation
4.1.3. Message Implementations
4.1.4. The MessageBuilder Helper Class
5. Message Routing
5.1. Routers
5.1.1. Overview
5.1.2. Common Router Parameters
Inside and Outside of a Chain
Top-Level (Outside of a Chain)
5.1.3. Router Implementations
PayloadTypeRouter
HeaderValueRouter
RecipientListRouter
XPath Router
Routing and Error handling
5.1.4. Configuring (Generic) Router
Configuring a Content Based Router with XML
Configuring a Router with Annotations
5.1.5. Dynamic Routers
Manage Router Mappings using the Control Bus
Manage Router Mappings using JMX
5.2. Filter
5.2.1. Introduction
5.2.2. Configuring Filter
Configuring a Filter with XML
Configuring a Filter with Annotations
5.3. Splitter
5.3.1. Introduction
5.3.2. Programming model
5.3.3. Configuring Splitter
Configuring a Splitter using XML
Configuring a Splitter with Annotations
5.4. Aggregator
5.4.1. Introduction
5.4.2. Functionality
5.4.3. Programming model
AggregatingMessageHandler
ReleaseStrategy
CorrelationStrategy
5.4.4. Configuring an Aggregator
Configuring an Aggregator with XML
Configuring an Aggregator with Annotations
5.4.5. Managing State in an Aggregator: MessageGroupStore
5.5. Resequencer
5.5.1. Introduction
5.5.2. Functionality
5.5.3. Configuring a Resequencer
5.6. Message Handler Chain
5.6.1. Introduction
5.6.2. Configuring a Chain
6. Message Transformation
6.1. Transformer
6.1.1. Introduction
6.1.2. Configuring Transformer
Configuring Transformer with XML
Configuring a Transformer with Annotations
6.1.3. Header Filter
6.2. Content Enricher
6.2.1. Introduction
6.2.2. Header Enricher
6.2.3. Payload Enricher
Configuration
Examples
6.3. Claim Check
6.3.1. Introduction
6.3.2. Incoming Claim Check Transformer
6.3.3. Outgoing Claim Check Transformer
6.3.4. A word on Message Store
7. Messaging Endpoints
7.1. Message Endpoints
7.1.1. Message Handler
7.1.2. Event Driven Consumer
7.1.3. Polling Consumer
7.1.4. Namespace Support
7.1.5. Change Polling Rate at Runtime
7.1.6. Payload Type Conversion
7.1.7. Asynchronous polling
7.1.8. Endpoint Inner Beans
7.2. Messaging Gateways
7.2.1. Enter the GatewayProxyFactoryBean
7.2.2. Gateway XML Namespace Support
7.2.3. Setting the Default Reply Channel
7.2.4. Gateway Configuration with Annotations and/or XML
7.2.5. Mapping Method Arguments to a Message
7.2.6. Invoking No-Argument Methods
7.2.7. Error Handling
7.2.8. Asynchronous Gateway
7.2.9. Gateway behavior when no response arrives
7.3. Service Activator
7.3.1. Introduction
7.3.2. Configuring Service Activator
7.4. Delayer
7.4.1. Introduction
7.4.2. Configuring Delayer
7.4.3. Delayer and Message Store
7.5. Scripting support
7.5.1. Script configuration
7.6. Groovy support
7.6.1. Groovy configuration
7.6.2. Control Bus
7.7. Adding Behavior to Endpoints
7.7.1. Provided Advice Classes
Retry Advice
Circuit Breaker Advice
Expression Evaluating Advice
7.7.2. Custom Advice Classes
7.7.3. Other Advice Chain Elements
7.7.4. Advising Filters
7.7.5. Advising Endpoints Using Annotations
7.7.6. Ordering Advices within an Advice Chain
7.8. Logging Channel Adapter
8. System Management
8.1. JMX Support
8.1.1. Notification Listening Channel Adapter
8.1.2. Notification Publishing Channel Adapter
8.1.3. Attribute Polling Channel Adapter
8.1.4. Tree Polling Channel Adapter
8.1.5. Operation Invoking Channel Adapter
8.1.6. Operation Invoking Outbound Gateway
8.1.7. MBean Exporter
MBean ObjectNames
MessageChannel MBean Features
Orderly Shutdown Managed Operation
8.2. Message History
8.2.1. Message History Configuration
8.3. Message Store
8.4. Metadata Store
8.4.1. Idempotent Receiver
8.5. Control Bus
8.6. Orderly Shutdown
IV. Integration Endpoints
9. Endpoint Quick Reference Table
10. AMQP Support
10.1. Introduction
10.2. Inbound Channel Adapter
10.3. Outbound Channel Adapter
10.4. Inbound Gateway
10.5. Outbound Gateway
10.6. AMQP Backed Message Channels
10.7. AMQP Message Headers
10.8. AMQP Samples
11. Spring ApplicationEvent Support
11.1. Receiving Spring ApplicationEvents
11.2. Sending Spring ApplicationEvents
12. Feed Adapter
12.1. Introduction
12.2. Feed Inbound Channel Adapter
13. File Support
13.1. Introduction
13.2. Reading Files
13.2.1. 'Tail'ing Files
13.3. Writing files
13.3.1. Generating Filenames
13.3.2. Specifying the Output Directory
13.3.3. Dealing with Existing Destination Files
13.3.4. File Outbound Channel Adapter
13.3.5. Outbound Gateway
13.4. File Transformers
14. FTP/FTPS Adapters
14.1. Introduction
14.2. FTP Session Factory
14.3. FTP Inbound Channel Adapter
14.4. FTP Outbound Channel Adapter
14.5. FTP Outbound Gateway
14.6. FTP Session Caching
14.7. RemoteFileTemplate
15. GemFire Support
15.1. Introduction
15.2. Inbound Channel Adapter
15.3. Continuous Query Inbound Channel Adapter
15.4. Outbound Channel Adapter
15.5. Gemfire Message Store
16. HTTP Support
16.1. Introduction
16.2. Http Inbound Gateway
16.3. Http Outbound Gateway
16.4. HTTP Namespace Support
16.5. Timeout Handling
16.6. HTTP Proxy configuration
16.7. HTTP Header Mappings
16.8. HTTP Samples
16.8.1. Multipart HTTP request - RestTemplate (client) and Http Inbound Gateway (server)
17. JDBC Support
17.1. Inbound Channel Adapter
17.1.1. Polling and Transactions
17.1.2. Max-rows-per-poll versus Max-messages-per-poll
17.2. Outbound Channel Adapter
17.3. Outbound Gateway
17.4. JDBC Message Store
17.4.1. The Generic JDBC Message Store
17.4.2. Backing Message Channels
17.4.3. Initializing the Database
17.4.4. Partitioning a Message Store
17.5. Stored Procedures
17.5.1. Supported Databases
17.5.2. Configuration
17.5.3. Common Configuration Attributes
17.5.4. Common Configuration Sub-Elements
17.5.5. Defining Parameter Sources
17.5.6. Stored Procedure Inbound Channel Adapter
17.5.7. Stored Procedure Outbound Channel Adapter
17.5.8. Stored Procedure Outbound Gateway
17.5.9. Examples
18. JPA Support
18.1. Supported Persistence Providers
18.2. Java Implementation
18.3. Namespace Support
18.3.1. Common XML Namespace Configuration Attributes
18.3.2. Providing JPA Query Parameters
18.3.3. Transaction Handling
18.4. Inbound Channel Adapter
18.4.1. Configuration Parameter Reference
18.5. Outbound Channel Adapter
18.5.1. Using an Entity Class
18.5.2. Using JPA Query Language (JPA QL)
18.5.3. Using Native Queries
18.5.4. Using Named Queries
18.5.5. Configuration Parameter Reference
18.6. Outbound Gateways
18.6.1. Common Configuration Parameters
18.6.2. Updating Outbound Gateway
18.6.3. Retrieving Outbound Gateway
18.6.4. JPA Outbound Gateway Samples
19. JMS Support
19.1. Inbound Channel Adapter
19.2. Message-Driven Channel Adapter
19.3. Outbound Channel Adapter
19.4. Inbound Gateway
19.5. Outbound Gateway
19.5.1. Attribute Reference
19.6. Mapping Message Headers to/from JMS Message
19.7. Message Conversion, Marshalling and Unmarshalling
19.8. JMS Backed Message Channels
19.9. Using JMS Message Selectors
19.10. JMS Samples
20. Mail Support
20.1. Mail-Sending Channel Adapter
20.2. Mail-Receiving Channel Adapter
20.3. Mail Namespace Support
20.4. Email Message Filtering
20.5. Transaction Synchronization
21. MongoDb Support
21.1. Introduction
21.2. Connecting to MongoDb
21.3. MongoDB Message Store
21.4. MongoDB Inbound Channel Adapter
21.5. MongoDB Outbound Channel Adapter
22. Redis Support
22.1. Introduction
22.2. Connecting to Redis
22.3. Messaging with Redis
22.3.1. Redis Publish/Subscribe channel
22.3.2. Redis Inbound Channel Adapter
22.3.3. Redis Outbound Channel Adapter
22.3.4. Redis Queue Inbound Channel Adapter
22.3.5. Redis Queue Outbound Channel Adapter
22.3.6. Redis Application Events
22.4. Redis Message Store
22.5. Redis Metadata Store
22.6. RedisStore Inbound Channel Adapter
22.7. RedisStore Outbound Channel Adapter
23. Resource Support
23.1. Introduction
23.2. Resource Inbound Channel Adapter
24. RMI Support
24.1. Introduction
24.2. Outbound RMI
24.3. Inbound RMI
24.4. RMI namespace support
25. SFTP Adapters
25.1. Introduction
25.2. SFTP Session Factory
25.2.1. Configuration Properties
25.3. SFTP Session Caching
25.4. RemoteFileTemplate
25.5. SFTP Inbound Channel Adapter
25.6. SFTP Outbound Channel Adapter
25.7. SFTP Outbound Gateway
25.8. SFTP/JSCH Logging
26. Stream Support
26.1. Introduction
26.2. Reading from streams
26.3. Writing to streams
26.4. Stream namespace support
27. Syslog Support
27.1. Introduction
27.2. Syslog <inbound-channel-adapter>
27.2.1. Example Configuration
28. TCP and UDP Support
28.1. Introduction
28.2. UDP Adapters
28.3. TCP Connection Factories
28.3.1. TCP Caching Client Connection Factory
28.3.2. TCP Failover Client Connection Factory
28.4. TCP Connection Interceptors
28.5. TCP Connection Events
28.6. TCP Adapters
28.7. TCP Gateways
28.8. TCP Message Correlation
28.8.1. Overview
28.8.2. Gateways
28.8.3. Collaborating Outbound and Inbound Channel Adapters
28.8.4. Transferring Headers
28.9. A Note About NIO
28.10. SSL/TLS Support
28.10.1. Overview
28.10.2. Getting Started
28.10.3. Advanced Techniques
28.11. IP Configuration Attributes
28.12. IP Message Headers
29. Twitter Adapter
29.1. Introduction
29.2. Twitter OAuth Configuration
29.3. Twitter Template
29.4. Twitter Inbound Adapters
29.4.1. Inbound Message Channel Adapter
29.4.2. Direct Inbound Message Channel Adapter
29.4.3. Mentions Inbound Message Channel Adapter
29.4.4. Search Inbound Message Channel Adapter
29.5. Twitter Outbound Adapter
29.5.1. Twitter Outbound Update Channel Adapter
29.5.2. Twitter Outbound Direct Message Channel Adapter
30. Web Services Support
30.1. Outbound Web Service Gateways
30.2. Inbound Web Service Gateways
30.3. Web Service Namespace Support
30.4. Outbound URI Configuration
31. XML Support - Dealing with XML Payloads
31.1. Introduction
31.2. Namespace Support
31.2.1. XPath Expressions
Providing Namespaces (Optional) to XPath Expressions
Using XPath Expressions with Default Namespaces
31.3. Transforming XML Payloads
31.3.1. Configuring Transformers as Beans
UnmarshallingTransformer
MarshallingTransformer
XsltPayloadTransformer
ResultTransformers
31.3.2. Namespace Support for XML Transformers
31.3.3. Namespace Configuration and ResultTransformers
31.4. Transforming XML Messages Using XPath
31.5. Splitting XML Messages
31.6. Routing XML Messages Using XPath
31.6.1. XML Payload Converter
31.7. XPath Header Enricher
31.8. Using the XPath Filter
31.9. #xpath SpEL Function
31.10. XML Validating Filter
32. XMPP Support
32.1. Introduction
32.2. XMPP Connection
32.3. XMPP Messages
32.3.1. Inbound Message Channel Adapter
32.3.2. Outbound Message Channel Adapter
32.4. XMPP Presence
32.4.1. Inbound Presence Message Channel Adapter
32.4.2. Outbound Presence Message Channel Adapter
32.5. Advanced Configuration
V. Appendices
A. Spring Expression Language (SpEL)
A.1. Introduction
A.2. SpEL Evaluation Context Customization
A.3. SpEL Functions
A.4. PropertyAccessors
B. Message Publishing
B.1. Message Publishing Configuration
B.1.1. Annotation-driven approach via @Publisher annotation
B.1.2. XML-based approach via the <publishing-interceptor> element
B.1.3. Producing and publishing messages based on a scheduled trigger
C. Transaction Support
C.1. Understanding Transactions in Message flows
C.1.1. Poller Transaction Support
C.2. Transaction Boundaries
C.3. Transaction Synchronization
C.4. Pseudo Transactions
D. Security in Spring Integration
D.1. Introduction
D.2. Securing channels
E. Spring Integration Samples
E.1. Introduction
E.2. Where to get Samples
E.3. Submitting Samples or Sample Requests
E.4. Samples Structure
E.5. Samples
E.5.1. Loan Broker
E.5.2. The Cafe Sample
E.5.3. The XML Messaging Sample
F. Configuration
F.1. Introduction
F.2. Namespace Support
F.3. Configuring the Task Scheduler
F.4. Error Handling
F.5. Annotation Support
F.6. Message Mapping rules and conventions
F.6.1. Simple Scenarios
F.6.2. Complex Scenarios
G. Additional Resources
G.1. Spring Integration Home
H. Change History
H.1. Changes between 1.0 and 2.0
H.1.1. Spring 3 support
Support for the Spring Expression Language (SpEL)
ConversionService and Converter
TaskScheduler and Trigger
RestTemplate and HttpMessageConverter
H.1.2. Enterprise Integration Pattern Additions
Message History
Message Store
Claim Check
Control Bus
H.1.3. New Channel Adapters and Gateways
TCP/UDP Adapters
Twitter Adapters
XMPP Adapters
FTP/FTPS Adapters
SFTP Adapters
Feed Adapters
H.1.4. Other Additions
Groovy Support
Map Transformers
JSON Transformers
Serialization Transformers
H.1.5. Framework Refactoring
H.1.6. New Source Control Management and Build Infrastructure
H.1.7. New Spring Integration Samples
H.1.8. SpringSource Tool Suite Visual Editor for Spring Integration
H.2. Changes between 2.0 and 2.1
H.2.1. New Components
JSR-223 Scripting Support
GemFire Support
AMQP Support
MongoDB Support
Redis Support
Support for Spring's Resource abstraction
Stored Procedure Components
XPath and XML Validating Filter
Payload Enricher
FTP and SFTP Outbound Gateways
FTP Session Caching
H.2.2. Framework Refactoring
Standardizing Router Configuration
XML Schemas updated to 2.1
H.2.3. Source Control Management and Build Infrastructure
Source Code now hosted on Github
Improved Source Code Visibility with Sonar
H.2.4. New Samples
H.3. Changes between 2.1 and 2.2
H.3.1. New Components
RedisStore Inbound and Outbound Channel Adapters
MongoDB Inbound and Outbound Channel Adapters
JPA Endpoints
H.3.2. General Changes
Spring 3.1 Used by Default
Adding Behavior to Endpoints
Transaction Synchronization and Pseudo Transactions
File Adapter - Improved File Overwrite/Append Handling
Reply-Timeout added to more Outbound Gateways
Spring-AMQP 1.1
JDBC Support - Stored Procedures Components
JDBC Support - Outbound Gateway
JDBC Support - Channel-specific Message Store Implementation
Orderly Shutdown
JMS Oubound Gateway Improvements
object-to-json-transformer
HTTP Support