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

5.0.7.BUILD-SNAPSHOT

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.


Table of Contents

I. Preface
Requirements
1. Compatible Java Versions
2. Compatible Versions of the Spring Framework
3. Code Conventions
1. Conventions in this Book
II. What’s new?
2. What’s new in Spring Integration 5.0?
2.1. New Components
2.1.1. Java DSL
2.1.2. Testing Support
2.1.3. MongoDB Outbound Gateway
2.1.4. WebFlux Gateways and Channel Adapters
2.1.5. Content Type Conversion
2.1.6. ErrorMessagePublisher and ErrorMessageStrategy
2.1.7. JDBC Metadata Store
2.2. General Changes
2.2.1. Core Changes
2.2.2. Gateway Changes
2.2.3. Aggregator Performance Changes
2.2.4. Splitter Changes
2.2.5. JMS Changes
2.2.6. Mail Changes
2.2.7. Feed Changes
2.2.8. File Changes
2.2.9. (S)FTP Changes
2.2.10. Integration Properties
2.2.11. Stream Changes
2.2.12. Barrier Changes
2.2.13. AMQP Changes
2.2.14. HTTP Changes
2.2.15. MQTT Changes
2.2.16. STOMP Changes
2.2.17. Web Services Changes
2.2.18. Redis Changes
2.2.19. TCP Changes
2.2.20. Gemfire Changes
2.2.21. Jdbc Changes
2.2.22. Metrics Changes
2.2.23. @EndpointId Annotations
2.2.24. Integration Flows: Generated bean names
III. Overview of Spring Integration Framework
3. Spring Integration Overview
3.1. Background
3.2. Goals and Principles
3.3. Main Components
3.3.1. Message
3.3.2. Message Channel
3.3.3. Message Endpoint
3.4. Message Endpoints
3.4.1. Transformer
3.4.2. Filter
3.4.3. Router
3.4.4. Splitter
3.4.5. Aggregator
3.4.6. Service Activator
3.4.7. Channel Adapter
3.4.8. Endpoint Bean Names
3.5. Configuration and @EnableIntegration
3.6. Programming Considerations
3.7. Considerations When using Packaged (e.g. Shaded) Jars
3.8. Programming Tips and Tricks
3.8.1. XML Schemas
3.8.2. Finding Class Names for Java and DSL Configuration
3.9. POJO Method invocation
IV. Core Messaging
4. Messaging Channels
4.1. Message Channels
4.1.1. The MessageChannel Interface
PollableChannel
SubscribableChannel
4.1.2. Message Channel Implementations
PublishSubscribeChannel
QueueChannel
PriorityChannel
RendezvousChannel
DirectChannel
ExecutorChannel
Scoped Channel
4.1.3. Channel Interceptors
4.1.4. MessagingTemplate
4.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 Configuration
Wire Tap
Conditional Wire Taps
Global Wire Tap Configuration
4.1.6. Special Channels
4.2. Poller
4.2.1. Polling Consumer
4.2.2. Pollable Message Source
4.2.3. Deferred Acknowledgment Pollable Message Source
4.2.4. Conditional Pollers for Message Sources
Background
"Smart" Polling
SimpleActiveIdleMessageSourceAdvice
CompoundTriggerAdvice
4.3. Channel Adapter
4.3.1. Configuring An Inbound Channel Adapter
4.3.2. Configuring An Outbound Channel Adapter
4.3.3. Channel Adapter Expressions and Scripts
4.4. Messaging Bridge
4.4.1. Introduction
4.4.2. Configuring a Bridge with XML
4.4.3. Configuring a Bridge with Java Configuration
4.4.4. Configuring a Bridge with the Java DSL
5. Message Construction
5.1. Message
5.1.1. The Message Interface
5.1.2. Message Headers
MessageHeaderAccessor API
Message ID Generation
Read-only Headers
Header Propagation
5.1.3. Message Implementations
5.1.4. The MessageBuilder Helper Class
6. Message Routing
6.1. Routers
6.1.1. Overview
6.1.2. Common Router Parameters
Inside and Outside of a Chain
Top-Level (Outside of a Chain)
6.1.3. Router Implementations
PayloadTypeRouter
HeaderValueRouter
RecipientListRouter
RecipientListRouterManagement
XPath Router
Routing and Error handling
6.1.4. Configuring a Generic Router
Configuring a Content Based Router with XML
Configuring a Router with Annotations
6.1.5. Dynamic Routers
Manage Router Mappings using the Control Bus
Manage Router Mappings using JMX
Routing Slip
Process Manager Enterprise Integration Pattern
6.2. Filter
6.2.1. Introduction
6.2.2. Configuring Filter
Configuring a Filter with XML
Configuring a Filter with Annotations
6.3. Splitter
6.3.1. Introduction
6.3.2. Programming model
6.3.3. Configuring Splitter
Configuring a Splitter using XML
Configuring a Splitter with Annotations
6.4. Aggregator
6.4.1. Introduction
6.4.2. Functionality
6.4.3. Programming model
AggregatingMessageHandler
ReleaseStrategy
Aggregating Large Groups
CorrelationStrategy
LockRegistry
6.4.4. Configuring an Aggregator
Configuring an Aggregator with XML
Configuring an Aggregator with Annotations
6.4.5. Managing State in an Aggregator: MessageGroupStore
6.5. Resequencer
6.5.1. Introduction
6.5.2. Functionality
6.5.3. Configuring a Resequencer
6.6. Message Handler Chain
6.6.1. Introduction
6.6.2. Configuring a Chain
6.7. Scatter-Gather
6.7.1. Introduction
6.7.2. Functionality
6.7.3. Configuring a Scatter-Gather Endpoint
6.8. Thread Barrier
7. Message Transformation
7.1. Transformer
7.1.1. Introduction
7.1.2. Configuring Transformer
Configuring Transformer with XML
Common Transformers
Configuring a Transformer with Annotations
7.1.3. Header Filter
7.1.4. Codec-Based Transformers
7.2. Content Enricher
7.2.1. Introduction
7.2.2. Header Enricher
Configuring a Header Enricher with Java Configuration
Configuring a Header Enricher with the Java DSL
Header Channel Registry
7.2.3. Payload Enricher
Configuration
Examples
7.3. Claim Check
7.3.1. Introduction
7.3.2. Incoming Claim Check Transformer
7.3.3. Outgoing Claim Check Transformer
7.3.4. A word on Message Store
7.4. Codec
7.4.1. Introduction
7.4.2. EncodingPayloadTransformer
7.4.3. DecodingTransformer
7.4.4. CodecMessageConverter
7.4.5. Kryo
Customizing Kryo
8. Messaging Endpoints
8.1. Message Endpoints
8.1.1. Message Handler
8.1.2. Event Driven Consumer
8.1.3. Polling Consumer
8.1.4. Endpoint Namespace Support
8.1.5. Change Polling Rate at Runtime
8.1.6. Payload Type Conversion
8.1.7. Content Type Conversion
8.1.8. Asynchronous polling
8.1.9. Endpoint Inner Beans
8.2. Endpoint Roles
8.3. Leadership Event Handling
8.4. Messaging Gateways
8.4.1. Enter the GatewayProxyFactoryBean
8.4.2. Gateway XML Namespace Support
8.4.3. Setting the Default Reply Channel
8.4.4. Gateway Configuration with Annotations and/or XML
8.4.5. Mapping Method Arguments to a Message
8.4.6. @MessagingGateway Annotation
8.4.7. Invoking No-Argument Methods
8.4.8. Error Handling
8.4.9. Gateway Timeouts
8.4.10. Asynchronous Gateway
Introduction
ListenableFuture
AsyncTaskExecutor
CompletableFuture
Reactor Mono
8.4.11. Gateway behavior when no response arrives
8.5. Service Activator
8.5.1. Introduction
8.5.2. Configuring Service Activator
8.5.3. Asynchronous Service Activator
8.6. Delayer
8.6.1. Introduction
8.6.2. Configuring a Delayer
8.6.3. Delayer and a Message Store
8.7. Scripting support
8.7.1. Script configuration
8.8. Groovy support
8.8.1. Groovy configuration
8.8.2. Control Bus
8.9. Adding Behavior to Endpoints
8.9.1. Introduction
8.9.2. Provided Advice Classes
Retry Advice
Circuit Breaker Advice
Expression Evaluating Advice
8.9.3. Custom Advice Classes
8.9.4. Other Advice Chain Elements
8.9.5. Handle Message Advice
8.9.6. Transaction Support
8.9.7. Advising Filters
8.9.8. Advising Endpoints Using Annotations
8.9.9. Ordering Advices within an Advice Chain
8.9.10. Advised Handler Properties
8.9.11. Idempotent Receiver Enterprise Integration Pattern
8.10. Logging Channel Adapter
8.10.1. Configuring with Java Configuration
8.10.2. Configuring with the Java DSL
9. Java DSL
9.1. Example Configurations
9.2. Introduction
9.3. DSL Basics
9.4. Message Channels
9.5. Pollers
9.6. DSL and Endpoint Configuration
9.7. Transformers
9.8. Inbound Channel Adapters
9.9. Message Routers
9.10. Splitters
9.11. Aggregators and Resequencers
9.12. ServiceActivators (.handle())
9.13. Operator log()
9.14. MessageChannelSpec.wireTap()
9.15. Working With Message Flows
9.16. FunctionExpression
9.17. Sub Flows support
9.18. Using Protocol Adapters
9.19. IntegrationFlowAdapter
9.20. Dynamic and runtime Integration Flows
9.21. IntegrationFlow as Gateway
10. System Management
10.1. Metrics and Management
10.1.1. Configuring Metrics Capture
10.1.2. Micrometer Integration
10.1.3. MessageChannel Metric Features
10.1.4. MessageHandler Metric Features
10.1.5. Time-Based Average Estimates
10.1.6. Metrics Factory
10.2. JMX Support
10.2.1. Notification Listening Channel Adapter
10.2.2. Notification Publishing Channel Adapter
10.2.3. Attribute Polling Channel Adapter
10.2.4. Tree Polling Channel Adapter
10.2.5. Operation Invoking Channel Adapter
10.2.6. Operation Invoking Outbound Gateway
10.2.7. MBean Exporter
MBean ObjectNames
JMX Improvements
Orderly Shutdown Managed Operation
10.3. Message History
10.3.1. Message History Configuration
10.4. Message Store
10.4.1. MessageGroupFactory
10.4.2. Persistence MessageGroupStore and Lazy-Load
10.5. Metadata Store
10.5.1. Idempotent Receiver and Metadata Store
10.5.2. MetadataStoreListener
10.6. Control Bus
10.7. Orderly Shutdown
10.8. Integration Graph
10.8.1. Graph Runtime Model
10.9. Integration Graph Controller
V. Integration Endpoints
11. Endpoint Quick Reference Table
12. AMQP Support
12.1. Introduction
12.2. Inbound Channel Adapter
12.2.1. Configuring with Java Configuration
12.2.2. Configuring with the Java DSL
12.3. Polled Inbound Channel Adapter
12.4. Inbound Gateway
12.4.1. Configuring with Java Configuration
12.4.2. Configuring with the Java DSL
12.5. Inbound Endpoint Acknowledge Mode
12.6. Outbound Channel Adapter
12.6.1. Configuring with Java Configuration
12.6.2. Configuring with the Java DSL
12.7. Outbound Gateway
12.7.1. Configuring with Java Configuration
12.7.2. Configuring with the Java DSL
12.8. Async Outbound Gateway
12.8.1. Configuring with Java Configuration
12.8.2. Configuring with the Java DSL
12.9. Outbound Message Conversion
12.10. Outbound User Id
12.11. Delayed Message Exchange
12.12. AMQP Backed Message Channels
12.12.1. Configuring with Java Configuration
12.12.2. Configuring with the Java DSL
12.13. AMQP Message Headers
12.14. AMQP Samples
13. Spring ApplicationEvent Support
13.1. Receiving Spring Application Events
13.2. Sending Spring Application Events
14. Feed Adapter
14.1. Introduction
14.2. Feed Inbound Channel Adapter
14.3. Java DSL and Annotation configuration
15. File Support
15.1. Introduction
15.2. Reading Files
15.2.1. Namespace Support
15.2.2. WatchServiceDirectoryScanner
15.2.3. Limiting Memory Consumption
15.2.4. Configuring with Java Configuration
15.2.5. Configuring with the Java DSL
15.2.6. 'Tail’ing Files
15.2.7. Dealing With Incomplete Data
15.3. Writing files
15.3.1. Generating File Names
15.3.2. Specifying the Output Directory
15.3.3. Dealing with Existing Destination Files
15.3.4. Flushing Files When using APPEND_NO_FLUSH
15.3.5. File Timestamps
15.3.6. File Permissions
15.3.7. File Outbound Channel Adapter
15.3.8. Outbound Gateway
15.3.9. Configuring with Java Configuration
15.3.10. Configuring with the Java DSL
15.4. File Transformers
15.5. File Splitter
15.5.1. Configuring with Java Configuration
15.5.2. Configuring with the Java DSL
16. FTP/FTPS Adapters
16.1. Introduction
16.2. FTP Session Factory
16.2.1. Default Factories
16.2.2. FTPS and Shared SSLSession
16.3. Delegating Session Factory
16.4. FTP Inbound Channel Adapter
16.4.1. Recovering from Failures
16.4.2. Configuring with Java Configuration
16.4.3. Configuring with the Java DSL
16.4.4. Dealing With Incomplete Data
16.5. FTP Streaming Inbound Channel Adapter
16.5.1. Configuring with Java Configuration
16.6. Inbound Channel Adapters: Polling Multiple Servers and Directories
16.7. Inbound Channel Adapters: Controlling Remote File Fetching
16.8. FTP Outbound Channel Adapter
16.8.1. Configuring with Java Configuration
16.8.2. Configuring with the Java DSL
16.9. FTP Outbound Gateway
16.9.1. Configuring with Java Configuration
16.9.2. Configuring with the Java DSL
16.9.3. Outbound Gateway Partial Success (mget and mput)
16.10. FTP Session Caching
16.11. RemoteFileTemplate
16.12. MessageSessionCallback
17. GemFire Support
17.1. Introduction
17.2. Inbound Channel Adapter
17.3. Continuous Query Inbound Channel Adapter
17.4. Outbound Channel Adapter
17.5. Gemfire Message Store
17.6. Gemfire Lock Registry
17.7. Gemfire Metadata Store
18. HTTP Support
18.1. Introduction
18.2. Http Inbound Components
18.3. Http Outbound Components
18.3.1. HttpRequestExecutingMessageHandler
18.4. HTTP Namespace Support
18.4.1. Introduction
18.4.2. Inbound
18.4.3. Request Mapping Support
18.4.4. Cross-Origin Resource Sharing (CORS) Support
18.4.5. Response StatusCode
18.4.6. URI Template Variables and Expressions
18.4.7. Outbound
18.4.8. Mapping URI Variables
18.4.9. Controlling URI Encoding
18.5. Configuring HTTP Endpoints with Java
18.6. Timeout Handling
18.7. HTTP Proxy configuration
18.8. HTTP Header Mappings
18.9. Integration Graph Controller
18.10. HTTP Samples
18.10.1. Multipart HTTP request - RestTemplate (client) and Http Inbound Gateway (server)
19. JDBC Support
19.1. Inbound Channel Adapter
19.1.1. Polling and Transactions
19.1.2. Max-rows-per-poll versus Max-messages-per-poll
19.2. Outbound Channel Adapter
19.3. Outbound Gateway