Spring Integration Reference Manual

Mark Fisher

Marius Bogoevici

Iwein Fuld

Jonas Partner

Oleg Zhurakousky

Gary Russell

Dave Syer

Josh Long

David Turanski

Gunnar Hillert

2.1.0.RC1

© SpringSource Inc., 2011


Table of Contents

Preface
1. Code Conventions
I. What's new?
1. What's new in Spring Integration 2.1?
1.1. New Components
1.1.1. JSR-223 Scripting Support
1.1.2. GemFire Support
1.1.3. AMQP Support
1.1.4. MongoDB Support
1.1.5. Redis Support
1.1.6. Stored Procedure Components
1.1.7. XPath and XML Validating Filter
1.1.8. Payload Enricher
1.1.9. FTP and SFTP Outbound Gateways
1.1.10. FTP Session Caching
1.2. Framework Refactoring
1.2.1. Standardizing Router Configuration
1.2.2. XML Schemas updated to 2.1
1.3. Source Control Management and Build Infrastructure
1.3.1. Source Code now hosted on Github
1.3.2. Improved Source Code Visibility with Sonar
1.4. New Samples
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. Channel Adapter
3.2.1. Configuring Inbound Channel Adapter
3.2.2. Configuring Outbound Channel Adapter
3.3. Messaging Bridge
3.3.1. Introduction
3.3.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
CorrelatingMessageHandler
ReleaseStrategy
CorrelationStrategy
5.4.4. Configuring 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. Payload Type Conversion
7.1.6. 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.5. Scripting support
7.5.1. Script configuration
7.6. Groovy support
7.6.1. Groovy configuration
7.6.2. Control Bus
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
8.2. Message History
8.2.1. Message History Configuration
8.3. Control Bus
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 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.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
15. HTTP Support
15.1. Introduction
15.2. Http Inbound Gateway
15.3. Http Outbound Gateway
15.4. HTTP Namespace Support
15.5. HTTP Proxy configuration
15.6. HTTP Header Mappings
15.7. HTTP Samples
15.7.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.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. IP Configuration Attributes
17. JDBC Support
17.1. Inbound Channel Adapter
17.1.1. Polling and Transactions
17.2. Outbound Channel Adapter
17.3. Outbound Gateway
17.4. Message Store
17.4.1. Initializing the Database
17.4.2. 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. JMS Support
18.1. Inbound Channel Adapter
18.2. Message-Driven Channel Adapter
18.3. Outbound Channel Adapter
18.4. Inbound Gateway
18.5. Outbound Gateway
18.6. Mapping Message Headers to/from JMS Message
18.7. Message Conversion, Marshalling and Unmarshalling
18.8. JMS Backed Message Channels
18.9. JMS Samples
19. Mail Support
19.1. Mail-Sending Channel Adapter
19.2. Mail-Receiving Channel Adapter
19.3. Mail Namespace Support
19.4. Email Message Filtering
20. MongoDb Support
20.1. Introduction
20.2. Connecting to MongoDb
20.3. MongoDB Message Store
21. Redis Support
21.1. Introduction
21.2. Connecting to Redis
21.3. Messaging with Redis
21.3.1. Redis Publish/Subscribe channel
21.3.2. Redis Inbound Channel Adapter
21.3.3. Redis Outbound Channel Adapter
21.4. Redis Message Store
22. RMI Support
22.1. Introduction
22.2. Outbound RMI
22.3. Inbound RMI
22.4. RMI namespace support
23. SFTP Adapters
23.1. Introduction
23.2. SFTP Session Factory
23.3. SFTP Inbound Channel Adapter
23.4. SFTP Outbound Channel Adapter
23.5. SFTP Outbound Gateway
23.6. SFTP/JSCH Logging
23.7. SFTP Session Caching
24. Stream Support
24.1. Introduction
24.2. Reading from streams
24.3. Writing to streams
24.4. Stream namespace support
25. Twitter Adapter
25.1. Introduction
25.2. Twitter OAuth Configuration
25.3. Twitter Template
25.4. Twitter Inbound Adapters
25.4.1. Inbound Message Channel Adapter
25.4.2. Direct Inbound Message Channel Adapter
25.4.3. Mentions Inbound Message Channel Adapter
25.4.4. Search Inbound Message Channel Adapter
25.5. Twitter Outbound Adapter
25.5.1. Twitter Outbound Update Channel Adapter
25.5.2. Twitter Outbound Direct Message Channel Adapter
26. Web Services Support
26.1. Outbound Web Service Gateways
26.2. Inbound Web Service Gateways
26.3. Web Service Namespace Support
27. XML Support - Dealing with XML Payloads
27.1. Introduction
27.2. Namespace Support
27.2.1. XPath Expressions
Providing Namespaces (Optional) to XPath Expressions
27.3. Transforming XML Payloads
27.3.1. Configuring Transformers as Beans
27.3.2. Namespace Support for XML Transformers
27.4. Transforming XML Messages Using XPath
27.5. Splitting XML Messages
27.6. Routing XML Messages Using XPath
27.6.1. XML Payload Converter
27.7. XPath Header Enricher
27.8. Using the XPath Filter
27.9. XML Validating Filter
28. XMPP Support
28.1. Introduction
28.2. XMPP Connection
28.3. XMPP Messages
28.3.1. Inbound Message Channel Adapter
28.3.2. Outbound Message Channel Adapter
28.4. XMPP Presence
28.4.1. Inbound Presence Message Channel Adapter
28.4.2. Outbound Presence Message Channel Adapter
28.5. Appendices
V. Appendices
29. Message Publishing
29.1. Message Publishing Configuration
29.1.1. Annotation-driven approach via @Publisher annotation
29.1.2. XML-based approach via the <publishing-interceptor> element
29.1.3. Producing and publishing messages based on a scheduled trigger
30. Transaction Support
30.1. Understanding Transactions in Message flows
30.1.1. Poller Transaction Support
30.2. Transaction Boundaries
31. Security in Spring Integration
31.1. Introduction
31.2. Securing channels
A. Spring Integration Samples
A.1. Introduction
A.2. Where to get Samples
A.3. Samples Structure
A.4. Samples
A.4.1. Loan Broker
A.4.2. The Cafe Sample
A.4.3. The XML Messaging Sample
B. Configuration
B.1. Introduction
B.2. Namespace Support
B.3. Configuring the Task Scheduler
B.4. Error Handling
B.5. Annotation Support
B.6. Message Mapping rules and conventions
B.6.1. Simple Scenarios
B.6.2. Complex Scenarios
C. Additional Resources
C.1. Spring Integration Home
D. Change History
D.1. Changes between 1.0 and 2.0
D.1.1. Spring 3 support
Support for the Spring Expression Language (SpEL)
ConversionService and Converter
TaskScheduler and Trigger
RestTemplate and HttpMessageConverter
D.1.2. Enterprise Integration Pattern Additions
Message History
Message Store
Claim Check
Control Bus
D.1.3. New Channel Adapters and Gateways
TCP/UDP Adapters
Twitter Adapters
XMPP Adapters
FTP/FTPS Adapters
SFTP Adapters
Feed Adapters
D.1.4. Other Additions
Groovy Support
Map Transformers
JSON Transformers
Serialization Transformers
D.1.5. Framework Refactoring
D.1.6. New Source Control Management and Build Infrastructure
D.1.7. New Spring Integration Samples
D.1.8. SpringSource Tool Suite Visual Editor for Spring Integration
D.2. Changes between 2.0 and 2.1