Spring Integration Reference Manual

Mark Fisher

Marius Bogoevici

Iwein Fuld

Jonas Partner

Oleg Zhurakousky

Gary Russell

Dave Syer

Josh Long

David Turanski

Gunnar Hillert

Artem Bilan

Amol Nayak

2.2.2.BUILD-SNAPSHOT


Table of Contents

Preface
1. Code Conventions
I. What's new?
1. What's new in Spring Integration 2.2?
1.1. New Components
1.1.1. RedisStore Inbound and Outbound Channel Adapters
1.1.2. MongoDB Inbound and Outbound Channel Adapters
1.1.3. JPA Endpoints
1.2. General Changes
1.2.1. Spring 3.1 Used by Default
1.2.2. Adding Behavior to Endpoints
1.2.3. Transaction Synchronization and Pseudo Transactions
1.2.4. File Adapter - Improved File Overwrite/Append Handling
1.2.5. Reply-Timeout added to more Outbound Gateways
1.2.6. Spring-AMQP 1.1
1.2.7. JDBC Support - Stored Procedures Components
1.2.8. JDBC Support - Outbound Gateway
1.2.9. JDBC Support - Channel-specific Message Store Implementation
1.2.10. Orderly Shutdown
1.2.11. JMS Oubound Gateway Improvements
1.2.12. object-to-json-transformer
1.2.13. HTTP Support
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 Outbound Channel Adapter
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
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 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.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. Invoking No-Argument Methods
7.2.6. Error Handling
7.2.7. Asynchronous Gateway
7.2.8. 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
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. Operation Invoking Channel Adapter
8.1.5. Operation Invoking Outbound Gateway
8.1.6. 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. Control Bus
8.5. Orderly Shutdown
IV. Integration Adapters
9. AMQP Support
9.1. Introduction
9.2. Inbound Channel Adapter
9.3. Outbound Channel Adapter
9.4. Inbound Gateway
9.5. Outbound Gateway
9.6. AMQP Backed Message Channels
9.7. AMQP Message Headers
9.8. AMQP Samples
10. Spring ApplicationEvent Support
10.1. Receiving Spring ApplicationEvents
10.2. Sending Spring ApplicationEvents
11. Feed Adapter
11.1. Introduction
11.2. Feed Inbound Channel Adapter
12. File Support
12.1. Introduction
12.2. Reading Files
12.3. Writing files
12.3.1. Specifying the Output Directory
12.3.2. Dealing with Existing Destination Files
12.3.3. File Outbound Channel Adapter
12.3.4. Outbound Gateway
12.4. File Transformers
13. FTP/FTPS Adapters
13.1. Introduction
13.2. FTP Session Factory
13.3. FTP Inbound Channel Adapter
13.4. FTP Outbound Channel Adapter
13.5. FTP Outbound Gateway
13.6. FTP Session Caching
14. GemFire Support
14.1. Introduction
14.2. Inbound Channel Adapter
14.3. Continuous Query Inbound Channel Adapter
14.4. Outbound Channel Adapter
14.5. Gemfire Message Store
15. HTTP Support
15.1. Introduction
15.2. Http Inbound Gateway
15.3. Http Outbound Gateway
15.4. HTTP Namespace Support
15.5. Timeout Handling
15.6. HTTP Proxy configuration
15.7. HTTP Header Mappings
15.8. HTTP Samples
15.8.1. Multipart HTTP request - RestTemplate (client) and Http Inbound Gateway (server)
16. TCP and UDP Support
16.1. Introduction
16.2. UDP Adapters
16.3. TCP Connection Factories
16.3.1. TCP Caching Client Connection Factory
16.3.2. TCP Failover Client Connection Factory
16.4. TCP Connection Interceptors
16.5. TCP Adapters
16.6. TCP Gateways
16.7. TCP Message Correlation
16.7.1. Overview
16.7.2. Gateways
16.7.3. Collaborating Outbound and Inbound Channel Adapters
16.8. A Note About NIO
16.9. SSL/TLS Support
16.9.1. Overview
16.9.2. Getting Started
16.9.3. Advanced Techniques
16.10. IP Configuration Attributes
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.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.4. Redis Message Store
22.5. RedisStore Inbound Channel Adapter
22.6. 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. SFTP Inbound Channel Adapter
25.5. SFTP Outbound Channel Adapter
25.6. SFTP Outbound Gateway
25.7. 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. Twitter Adapter
27.1. Introduction
27.2. Twitter OAuth Configuration
27.3. Twitter Template
27.4. Twitter Inbound Adapters
27.4.1. Inbound Message Channel Adapter
27.4.2. Direct Inbound Message Channel Adapter
27.4.3. Mentions Inbound Message Channel Adapter
27.4.4. Search Inbound Message Channel Adapter
27.5. Twitter Outbound Adapter
27.5.1. Twitter Outbound Update Channel Adapter
27.5.2. Twitter Outbound Direct Message Channel Adapter
28. Web Services Support
28.1. Outbound Web Service Gateways
28.2. Inbound Web Service Gateways
28.3. Web Service Namespace Support
28.4. Outbound URI Configuration
29. XML Support - Dealing with XML Payloads
29.1. Introduction
29.2. Namespace Support
29.2.1. XPath Expressions
Providing Namespaces (Optional) to XPath Expressions
Using XPath Expressions with Default Namespaces
29.3. Transforming XML Payloads
29.3.1. Configuring Transformers as Beans
UnmarshallingTransformer
MarshallingTransformer
XsltPayloadTransformer
ResultTransformers
29.3.2. Namespace Support for XML Transformers
29.3.3. Namespace Configuration and ResultTransformers
29.4. Transforming XML Messages Using XPath
29.5. Splitting XML Messages
29.6. Routing XML Messages Using XPath
29.6.1. XML Payload Converter
29.7. XPath Header Enricher
29.8. Using the XPath Filter
29.9. XML Validating Filter
30. XMPP Support
30.1. Introduction
30.2. XMPP Connection
30.3. XMPP Messages
30.3.1. Inbound Message Channel Adapter
30.3.2. Outbound Message Channel Adapter
30.4. XMPP Presence
30.4.1. Inbound Presence Message Channel Adapter
30.4.2. Outbound Presence Message Channel Adapter
30.5. Appendices
V. Appendices
A. Message Publishing
A.1. Message Publishing Configuration
A.1.1. Annotation-driven approach via @Publisher annotation
A.1.2. XML-based approach via the <publishing-interceptor> element
A.1.3. Producing and publishing messages based on a scheduled trigger
B. Transaction Support
B.1. Understanding Transactions in Message flows
B.1.1. Poller Transaction Support
B.2. Transaction Boundaries
B.3. Transaction Synchronization
B.4. Pseudo Transactions
C. Security in Spring Integration
C.1. Introduction
C.2. Securing channels
D. Spring Integration Samples
D.1. Introduction
D.2. Where to get Samples
D.3. Submitting Samples or Sample Requests
D.4. Samples Structure
D.5. Samples
D.5.1. Loan Broker
D.5.2. The Cafe Sample
D.5.3. The XML Messaging Sample
E. Configuration
E.1. Introduction
E.2. Namespace Support
E.3. Configuring the Task Scheduler
E.4. Error Handling
E.5. Annotation Support
E.6. Message Mapping rules and conventions
E.6.1. Simple Scenarios
E.6.2. Complex Scenarios
F. Additional Resources
F.1. Spring Integration Home
G. Change History
G.1. Changes between 1.0 and 2.0
G.1.1. Spring 3 support
Support for the Spring Expression Language (SpEL)
ConversionService and Converter
TaskScheduler and Trigger
RestTemplate and HttpMessageConverter
G.1.2. Enterprise Integration Pattern Additions
Message History
Message Store
Claim Check
Control Bus
G.1.3. New Channel Adapters and Gateways
TCP/UDP Adapters
Twitter Adapters
XMPP Adapters
FTP/FTPS Adapters
SFTP Adapters
Feed Adapters
G.1.4. Other Additions
Groovy Support
Map Transformers
JSON Transformers
Serialization Transformers
G.1.5. Framework Refactoring
G.1.6. New Source Control Management and Build Infrastructure
G.1.7. New Spring Integration Samples
G.1.8. SpringSource Tool Suite Visual Editor for Spring Integration
G.2. Changes between 2.0 and 2.1
G.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
G.2.2. Framework Refactoring
Standardizing Router Configuration
XML Schemas updated to 2.1
G.2.3. Source Control Management and Build Infrastructure
Source Code now hosted on Github
Improved Source Code Visibility with Sonar
G.2.4. New Samples
G.3. Changes between 2.1 and 2.2