This chapter provides an overview of the new features and improvements that have been introduced with Spring Integration 5.0. If you are interested in more details, please see the Issue Tracker tickets that were resolved as part of the 5.0 development process.
The separate Spring Integration Java DSL project has now been merged into the core Spring Integration project.
IntegrationComponentSpec implementations for channel adapters and gateways are distributed to their specific modules.
See Chapter 9, Java DSL for more information about Java DSL support.
Also see the 4.3 to 5.0 Migration Guide for the required steps to move to Spring Integration 5.0.
A new Spring Integration Test Framework has been created to assist with testing Spring Integration applications.
Now, with the
@SpringIntegrationTest annotation on test class and
MockIntegration factory you can make your JUnit tests for integration flows somewhat easier.
See Appendix F, Testing support for more information.
MongoDbOutboundGateway allows you to make queries to the database on demand by sending a message to its request channel.
See Section 23.6, “MongoDB Outbound Gateway” for more information.
The new WebFlux support module has been introduced for Spring WebFlux Framework gateways and channel adapters.
See Chapter 34, WebFlux Support for more information.
Now that we use the new
InvocableHandlerMethod -based infrastructure for service method invocations, we can perform
contentType conversion from payload to target method argument.
See Section 8.1.7, “Content Type Conversion” for more information.
ErrorMessagePublisher and the
ErrorMessageStrategy are provided for creating
See Section E.4, “Error Handling” for more information.
A JDBC implementation of
MetadataStore implementation is now provided.
This is useful when it is necessary to ensure transactional boundaries for metadata.
See Section 19.7, “JDBC Metadata Store” for more information.
Spring Integration is now fully based on Spring Framework
5.0 and Project Reactor
Previous Project Reactor versions are no longer supported.
@Poller annotation now has the
errorChannel attribute for easier configuration of the underlying
See Section E.6, “Annotation Support” for more information.
All the request-reply endpoints (based on
AbstractReplyProducingMessageHandler) can now start transaction and, therefore, make the whole downstream flow transactional.
See Section 8.9.6, “Transaction Support” for more information.
SmartLifecycleRoleController now provides methods to obtain status of endpoints in roles.
See Section 8.2, “Endpoint Roles” for more information.
POJO methods are now invoked using an
InvocableHandlerMethod by default, but can be configured to use SpEL as before.
See Section 3.9, “POJO Method invocation” for more information.
When targeting POJO methods as message handlers, one of the service methods can now be marked with the
@Default annotation to provide a fallback mechanism for non-matched conditions.
See Section 8.5.2, “Configuring Service Activator” for more information.
PassThroughTransactionSynchronizationFactory is provided to always store a polled message in the current transaction context.
That message is used as a
failedMessage property of the
MessagingException which wraps a raw exception thrown during transaction completion.
See Section C.3, “Transaction Synchronization” for more information.
The aggregator expression-based
ReleaseStrategy now evaluates the expression against the
MessageGroup instead of just the collection of
See the section called “Aggregators and Spring Expression Language (SpEL)” for more information.
ObjectToMapTransformer can now be supplied with a customised
See the section called “Aggregators and Spring Expression Language (SpEL)” for more information.
@GlobalChannelInterceptor annotation and
<int:channel-interceptor> now support negative patterns (via
! prepending) for component names matching.
See the section called “Global Channel Interceptor Configuration” for more information.
OnFailedToAcquireMutexEvent is emitted now via
DefaultLeaderEventPublisher by the
LockRegistryLeaderInitiator, when candidate is failed to acquire the lock.
See Section 8.3, “Leadership Event Handling” for more information.
The gateway now correctly sets the
errorChannel header when the gateway method has a
void return type and an error channel is provided.
Previously, the header was not populated.
This had the effect that synchronous downstream flows (running on the calling thread) would send the exception to the configured channel but an exception on an async downstream flow would be sent to the default
RequestReplyExchanger interface now has a
throws MessagingException clause to meet all the proposed messages exchange contract.
The request and reply timeouts can now be specified as SpEL expressions.
See Section 8.4, “Messaging Gateways” for more information.
Aggregators now use a
SimpleSequenceSizeReleaseStrategy by default, which is more efficient, especially with large groups.
Empty groups are now scheduled for removal after
See Section 6.4, “Aggregator” for more information.
The Splitter component now can handle and split Java
Stream and Reactive Streams
If the output channel is a
AbstractMessageSplitter builds a
Flux for subsequent iteration instead of a regular
Iterator independent of object being split.
protected obtainSizeIfPossible() methods to allow the determination of the size of the
Iterator objects if that is possible.
See Section 6.3, “Splitter” for more information.
Previously, Spring Integration JMS XML configuration used a default bean name
connectionFactory for the JMS Connection Factory, allowing the property to be omitted from component definitions.
It has now been renamed to
jmsConnectionFactory, which is the bean name used by Spring Boot to auto-configure the JMS Connection Factory bean.
If your application is relying on the previous behavior, rename your
connectionFactory bean to
jmsConnectionFactory, or specifically configure your components to use your bean using its current name.
See Chapter 21, JMS Support for more information.
Some inconsistencies with rendering IMAP mail content have been resolved.
See the note in the Mail-Receiving Channel Adapter Section for more information.
Instead of the
com.rometools.fetcher.FeedFetcher, which is deprecated in ROME, a new
Resource property has been introduced to the
See Chapter 14, Feed Adapter for more information.
FileHeaders.RELATIVE_PATH Message header has been introduced to represent relative path in the
The tail adapter now supports
idleEventInterval to emit events when there is no data in the file during that period.
The flush predicates for the
FileWritingMessageHandler now have an additional parameter.
The file outbound channel adapter and gateway (
FileWritingMessageHandler) now support the
They also now support setting file permissions on the newly written file.
FileSystemMarkerFilePresentFileListFilter is now available; see Section 15.2.7, “Dealing With Incomplete Data” for more information.
FileSplitter now provides a
firstLineAsHeader option to carry the first line of content as a header in the messages emitted for the remaining lines.
See Chapter 15, File Support for more information.
The Inbound Channel Adapters now have a property
max-fetch-size which is used to limit the number of files fetched during a poll when there are no files currently in the local directory.
They also are configured with a
FileSystemPersistentAcceptOnceFileListFilter in the
local-filter by default.
You can also provide a custom
DirectoryScanner implementation to Inbound Channel Adapters via the newly introduced
The regex and pattern filters can now be configured to always pass directories. This can be useful when using recursion in the outbound gateways.
All the Inbound Channel Adapters (streaming and synchronization-based) now use an appropriate
AbstractPersistentAcceptOnceFileListFilter implementation by default to prevent remote files duplicate downloads.
The FTP and SFTP outbound gateways now support the
FileExistsMode when fetching remote files.
The (S)FTP streaming inbound channel adapters now add remote file information in a message header.
The FTP and SFTP outbound channel adapters, as well as
PUT command of the outbound gateways, now support
The inbound channel adapters now can build file tree locally using a newly introduced
scanner option for injection.
Also these adapters can now be switched to the
NLST command has been added to the
AbstractRemoteFileOutboundGateway to perform only list files names remote command.
FtpOutboundGateway can now be supplied with
workingDirExpression to change the FTP client working directory for the current request message.
RemoteFileTemplate is supplied now with the
invoke(OperationsCallback<F, T> action) to perform several
RemoteFileOperations calls in the scope of the same, thread-bounded,
New filters for detecting incomplete remote files are now provided.
SftpOutboundGateway now support an option to remove the remote file after a successful transfer using the
See Chapter 16, FTP/FTPS Adapters and Chapter 28, SFTP Adapters for more information.
Since version 4.3.2 a new
spring.integration.readOnly.headers global property has been added to customize the list of headers which should not be copied to a newly created
Message by the
See Section E.5, “Global Properties” for more information.
There is a new option on the
CharacterStreamReadingMessageSource to allow it to be used to "pipe" stdin and publish an application event when the pipe is closed.
See Section 30.2, “Reading from streams” for more information.
BarrierMessageHandler now supports a discard channel to which late-arriving trigger messages are sent.
See Section 6.8, “Thread Barrier” for more information.
The AMQP outbound endpoints now support setting a delay expression for when using the RabbitMQ Delayed Message Exchange plugin.
The inbound endpoints now support the Spring AMQP
Pollable AMQP-backed channels now block the poller thread for the poller’s configured
receiveTimeout (default 1 second).
Headers, such as
contentType that are added to message properties by the message converter are now used in the final message; previously, it depended on the converter type as to which headers/message properties appeared in the final message.
To override headers set by the converter, set the
headersMappedLast property to
See Chapter 12, AMQP Support for more information.
DefaultHttpHeaderMapper.userDefinedHeaderPrefix property is now an empty string by default instead of
See Section 18.8, “HTTP Header Mappings” for more information.
Inbound messages are now mapped with headers
RECEIVED_RETAINED to avoid inadvertent propagation to outbound messages when an application is relaying messages.
The outbound channel adapter now supports expressions for the topic, qos and retained properties; the defaults remain the same.
See Chapter 24, MQTT Support for more information.
The STOMP module has been changed to use
ReactorNettyTcpStompClient, based on the Project Reactor
Reactor2TcpStompSessionManager has been renamed to the
ReactorNettyTcpStompSessionManager according to the
See Chapter 29, STOMP Support for more information.
WebServiceOutboundGateways can now be supplied with an externally configured
DefaultSoapHeaderMappercan now map a
javax.xml.transform.Sourceuser-defined header to a SOAP header element.
payload, allowing the manipulation of MTOM attachments.
See Chapter 36, Web Services Support for more information.
RedisStoreWritingMessageHandler is supplied now with additional String-based setters for SpEL expressions - for convenience with Java configuration.
zsetIncrementExpression can now be configured on the
RedisStoreWritingMessageHandler, as well.
In addition this property has been changed from
INCR option on
ZADD Redis command is optional.
RedisInboundChannelAdapter can now be supplied with an
Executor for executing Redis listener invokers.
In addition the received messages now contains a
RedisHeaders.MESSAGE_SOURCE header to indicate the source of the message - topic or pattern.
See Chapter 25, Redis Support for more information.
ThreadAffinityClientConnectionFactory is provided that binds TCP connections to threads.
You can now configure the TCP connection factories to support
PushbackInputStream s, allowing deserializers to "unread" (push back) bytes after "reading ahead".
ByteArrayElasticRawDeserializer has been added without
maxMessageSize control and buffer incoming data as needed.
See Chapter 32, TCP and UDP Support for more information.
GemfireMetadataStore now implements
ListenableMetadataStore, allowing users to listen to cache events by providing
MetadataStoreListener instances to the store.
See Chapter 17, GemFire Support for more information.
JdbcMessageChannelStore now provides setter for the
ChannelMessageStorePreparedStatementSetter allowing users to customize a message insertion in the store.
ExpressionEvaluatingSqlParameterSourceFactory now provides setter for the sqlParameterTypes allowing users to customize sql types of the parameters.
See Chapter 19, JDBC Support for more information.
Micrometer application monitoring is now supported (since version 5.0.2). See Section 10.1.2, “Micrometer Integration” for more information.
Changes were made to the Micrometer
Introduced in version 5.0.4, this annotation provides control over bean naming when using Java configuration. See Section 3.4.8, “Endpoint Bean Names” for more information.