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.
The IntegrationComponentSpec
implementations for channel adapters and gateways are distributed to their specific modules.
See Part V, “Integration Endpoints” for more information about Java DSL support for target protocol integration.
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.
The new MongoDbOutboundGateway
allows you to make queries to the database on demand by sending a message to its request channel.
See Section 22.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 33, 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.
The ErrorMessagePublisher
and the ErrorMessageStrategy
are provided for creating ErrorMessage
instances.
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 18.7, “JDBC Metadata Store” for more information.
Spring Integration is now fully based on Spring Framework 5.0
and Project Reactor 3.1
.
Previous Project Reactor versions are no longer supported.
The @Poller
annotation now has the errorChannel
attribute for easier configuration of the underlying MessagePublishingErrorHandler
.
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.
The 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.8, “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.
A simple 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 Message<?>
.
See the section called “Aggregators and Spring Expression Language (SpEL)” for more information.
The ObjectToMapTransformer
can now be supplied with a customised JsonObjectMapper
.
See the section called “Aggregators and Spring Expression Language (SpEL)” for more information.
The @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.
A new 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 errorChannel
instead.
The 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 empty-group-min-timeout
.
See Section 6.4, “Aggregator” for more information.
The Splitter component now can handle and split Java Stream
and Reactive Streams Publisher
objects.
If the output channel is a ReactiveStreamsSubscribableChannel
, the AbstractMessageSplitter
builds a Flux
for subsequent iteration instead of a regular Iterator
independent of object being split.
In addition, AbstractMessageSplitter
provides protected obtainSizeIfPossible()
methods to allow the determination of the size of the Iterable
and 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 20, 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 FeedEntryMessageSource
.
See Chapter 13, Feed Adapter for more information.
The new FileHeaders.RELATIVE_PATH
Message header has been introduced to represent relative path in the FileReadingMessageSource
.
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 REPLACE_IF_MODIFIED
FileExistsMode
.
They also now support setting file permissions on the newly written file.
A new FileSystemMarkerFilePresentFileListFilter
is now available; see Section 14.2.7, “Dealing With Incomplete Data” for more information.
The 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 14, 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 scanner
attribute.
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 REPLACE_IF_MODIFIED
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 InputStream
as payload
, too.
The inbound channel adapters now can build file tree locally using a newly introduced RecursiveDirectoryScanner
.
See scanner
option for injection.
Also these adapters can now be switched to the WatchService
instead.
The NLST
command has been added to the AbstractRemoteFileOutboundGateway
to perform only list files names remote command.
The FtpOutboundGateway
can now be supplied with workingDirExpression
to change the FTP client working directory for the current request message.
The RemoteFileTemplate
is supplied now with the invoke(OperationsCallback<F, T> action)
to perform several RemoteFileOperations
calls in the scope of the same, thread-bounded, Session
.
New filters for detecting incomplete remote files are now provided.
The FtpOutboundGateway
and SftpOutboundGateway
now support an option to remove the remote file after a successful transfer using the GET
or MGET
commands.
See Chapter 15, FTP/FTPS Adapters and Chapter 27, 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 MessageBuilder
.
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 29.2, “Reading from streams” for more information.
The 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 DirectMessageListenerContainer
.
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 true
.
See Chapter 11, AMQP Support for more information.
The DefaultHttpHeaderMapper.userDefinedHeaderPrefix
property is now an empty string by default instead of X-
.
See Section 17.8, “HTTP Header Mappings” for more information.
Inbound messages are now mapped with headers RECEIVED_TOPIC
, RECEIVED_QOS
and 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 23, MQTT Support for more information.
The STOMP module has been changed to use ReactorNettyTcpStompClient
, based on the Project Reactor 3.1
and reactor-netty
extension.
The Reactor2TcpStompSessionManager
has been renamed to the ReactorNettyTcpStompSessionManager
according to the ReactorNettyTcpStompClient
foundation.
See Chapter 28, STOMP Support for more information.
WebServiceOutboundGateway
s can now be supplied with an externally configured WebServiceTemplate
instances.
DefaultSoapHeaderMapper
can now map a javax.xml.transform.Source
user-defined header to a SOAP header element.
WebServiceMessage
as a payload
, allowing the manipulation of MTOM attachments.
See Chapter 35, Web Services Support for more information.
The RedisStoreWritingMessageHandler
is supplied now with additional String-based setters for SpEL expressions - for convenience with Java configuration.
The zsetIncrementExpression
can now be configured on the RedisStoreWritingMessageHandler
, as well.
In addition this property has been changed from true
to false
since INCR
option on ZADD
Redis command is optional.
The RedisInboundChannelAdapter
can now be supplied with an Executor
for executing Redis listener invokers.
See Chapter 24, Redis Support for more information.
A new 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".
A ByteArrayElasticRawDeserializer
has been added without maxMessageSize
control and buffer incoming data as needed.
See Chapter 31, TCP and UDP Support for more information.
The GemfireMetadataStore
now implements ListenableMetadataStore
, allowing users to listen to cache events by providing MetadataStoreListener
instances to the store.
See Chapter 16, GemFire Support for more information.
The JdbcMessageChannelStore
now provides setter for the ChannelMessageStorePreparedStatementSetter
allowing users to customize a message insertion in the store.
See Section 18.4.3, “Backing Message Channels” for more information.