This chapter provides an overview of the new features and improvements that have been introduced with Spring Integration 4.1. If you are interested in more details, please see the Issue Tracker tickets that were resolved as part of the 4.1 development process.
A new MetricsFactory
strategy interface has been introduced.
This, together with other changes in the JMX and management infrastructure provides much more control over management
configuration and runtime performance.
However, this has some important implications for (some) user environments.
For complete details, see Section 9.1, “Metrics and Management” and the section called “JMX Improvements”.
The MongoDbMetadataStore
is now available. For more information, see Section 22.3.2, “MongodDB Metadata Store”.
The @SecuredChannel
annotation has been introduced, replacing the deprecated ChannelSecurityInterceptorFactoryBean
.
For more information, see Appendix D, Security in Spring Integration.
The SecurityContextPropagationChannelInterceptor
has been
introduced for the SecurityContext
propagation from one message flow’s Thread to another.
For more information, see Appendix D, Security in Spring Integration.
The FileSplitter
, which splits text files into lines, was added in 4.1.2.
It now has full support in the int-file:
namespace; see Section 14.5, “File Splitter” for more information.
Zookeeper support has been added to the framework to assist when running on a clustered/multi-host environment.
See Chapter 37, Zookeeper Support for more information.
A new thread <int:barrier/>
component is available allowing a thread to be suspended until some asynchronous event
occurs.
See Section 6.8, “Thread Barrier” for more information.
STOMP support has been added to the framework as inbound and outbound channel adapters pair. See Chapter 28, STOMP Support for more information.
A new Codec
abstraction has been introduced, to encode/decode objects to/from byte[]
.
An implementation that uses Kryo is provided.
Codec-based transformers and message converters are also provided.
See Section 7.4, “Codec” for more information.
A new MessagePreparedStatementSetter
functional interface callback is available for the JdbcMessageHandler
(<int-jdbc:outbound-gateway>
and <int-jdbc:outbound-channel-adapter>
) as an alternative to the
SqlParameterSourceFactory
to populate parameters on the PreparedStatement
with the requestMessage
context.
See Section 18.2, “Outbound Channel Adapter” for more information.
As an alternative to the existing selector
attribute, the <wire-tap/>
now supports the selector-expression
attribute.
See Chapter 14, File Support for more information about these changes.
The <int-file:outbound-channel-adapter>
and <int-file:outbound-gateway>
now support an append-new-line
attribute.
If set to true
, a new line is appended to the file after a message is written.
The default attribute value is false
.
The ignore-hidden
attribute has been introduced for the <int-file:inbound-channel-adapter>
to pick up or not
the hidden files from the source directory.
It is true
by default.
The FileWritingMessageHandler
now also accepts InputStream
as a valid message payload type.
The ScatterGatherHandler
class has been moved from the org.springframework.integration.handler
to the org.springframework.integration.scattergather
.
The TCP Serializers
no longer flush()
the OutputStream
; this is now done by the TcpNxxConnection
classes.
If you are using the serializers directly within user code, you may have to flush()
the OutputStream
.
TcpConnectionServerExceptionEvent
s are now published whenever an unexpected exception occurs on a TCP server socket (also added to 4.1.3, 4.0.7).
See Section 31.5, “TCP Connection Events” for more information.
If a TCP server socket factory is configured to listen on a random port, the actual port chosen by the OS can now
be obtained using getPort()
.
getServerSocketAddress()
is also available.
See Section 31.3, “TCP Connection Factories” for more information.
The TcpOutboundGateway
now supports remote-timeout-expression
as an alternative to the existing remote-timeout
attribute.
This allows setting the timeout based on each message.
Also, the remote-timeout
no longer defaults to the same value as reply-timeout
which has a completely different meaning.
See Table 31.7, “TCP Outbound Gateway Attributes” for more information.
TcpConnection
s now support getSslSession()
to enable users to extract information from the session to add to
message headers.
See Section 31.12, “IP Message Headers” for more information.
New events are now published whenever a correlation exception occurs - for example sending a message to a non-existent socket.
The TcpConnectionEventListeningMessageProducer
is deprecated; use the generic event adapter instead.
See Section 31.5, “TCP Connection Events” for more information.
Previously, the @Poller
on an inbound channel adapter defaulted the maxMessagesPerPoll
attribute to -1
(infinity).
This was inconsistent with the XML configuration of <inbound-channel-adapter/>
s, which defaults to 1.
The annotation now defaults this attribute to 1.
o.s.integration.util.FunctionIterator
now requires a o.s.integration.util.Function
instead of a
reactor.function.Function
.
This was done to remove an unnecessary hard dependency on Reactor.
Any uses of this iterator will need to change the import.
Of course, Reactor is still supported for functionality such as the Promise
gateway; the dependency was removed for those users who don’t need it.
It is now possible to configure the reply listener in JMS outbound gateways to be initialized on-demand and stopped after an idle period, instead of being controlled by the gateway’s lifecycle.
See Section 20.5, “Outbound Gateway” for more information.
The error-channel
now is used for the conversion errors, which have caused a transaction rollback and message redelivery previously.
See Section 20.2, “Message-Driven Channel Adapter” and Section 20.4, “Inbound Gateway” for more information.
When using an implicitly defined DefaultMessageListenerContainer
, the default acknowledge
is now transacted
.
transacted
is recommended when using this container, to avoid message loss.
This default now applies to the message-driven inbound adapter and the inbound gateway, it was already the
default for jms-backed channels.
See Section 20.2, “Message-Driven Channel Adapter” and Section 20.4, “Inbound Gateway” for more information.
Namespace support for shared subscriptions (JMS 2.0) has been added to message-driven endpoints and the
<int-jms:publish-subscribe-channel>
.
Previously, you had to wire up listener containers as <bean/>
s to use shared connections.
See Chapter 20, JMS Support for more information.
Much more flexibility is now provided for dynamic polling.
See Section 4.2.3, “Conditional Pollers for Message Sources” for more information.
The <int-amqp:outbound-gateway>
now supports confirm-correlation-expression
and confirm-(n)ack-channel
attributes with similar purpose as for <int-amqp:outbound-channel-adapter>
.
For both the outbound channel adapter and gateway, if the correlation data is a Message<?>
, it will be the basis
of the message on the ack/nack channel, with the additional header(s) added.
Previously, any correlation data (including Message<?>
) was returned as the payload of the ack/nack message.
See Chapter 11, AMQP Support for more information.
The XPathMessageSplitter
(<int-xml:xpath-splitter>
) now allows the configuration of output-properties
for the internal javax.xml.transform.Transformer
and supports an Iterator
mode (defaults to true
) for the xpath
evaluation org.w3c.dom.NodeList
result.
See Section 35.5, “Splitting XML Messages” for more information.
The HTTP Inbound Endpoints (<int-http:inbound-channel-adapter>
and <int-http:inbound-gateway>
) now allow the
configuration of Cross-Origin Resource Sharing (CORS).
See Section 17.4.4, “Cross-Origin Resource Sharing (CORS) Support” for more information.
The HTTP inbound gateway can be configured as to what status code to return when a request times out.
The default is now 500 Internal Server Error
instead of 200 OK
.
See Section 17.4.5, “Response StatusCode” for more information.
The AbstractPersistentFileListFilter
has a new property flushOnUpdate
which, when set to true, will flush()
the
metadata store if it implements Flushable
(e.g. the PropertiesPersistingMetadataStore
).
When using Java 8, gateway methods can now return CompletableFuture<?>
.
See the section called “CompletableFuture” for more information.
The request and reply timeout properties are now String
instead of Long
to allow configuration with property
placeholders or SpEL. See Section 8.3.6, “@MessagingGateway Annotation”.
This release includes some performance improvements for aggregating components (aggregator, resequencer, etc),
by more efficiently removing messages from groups when they are released.
New methods (removeMessagesFromGroup
) have been added to the message store.
Set the removeBatchSize
property (default 100
) to adjust the number of messages deleted in each operation.
Currently, JDBC, Redis and MongoDB message stores support this property.
When using a ref
or inner bean for the aggregator, it is now possible to bind a MessageGroupProcessor
directly.
In addition, a SimpleMessageGroupProcessor
is provided that simply returns the collection of messages in the group.
When an output processor produces a collection of Message<?>
, the aggregator releases those messages individually.
Configuring the SimpleMessageGroupProcessor
makes the aggregator a message barrier, were messages are held up
until they all arrive, and are then released individually. See Section 6.4, “Aggregator” for more information.
You can now specify a remote-directory-expression
on the inbound channel adapters, to determine the directory
at runtime.
See Chapter 15, FTP/FTPS Adapters and Chapter 27, SFTP Adapters for more information.
When use FTP/SFTP outbound gateways to operate on multiple files (mget
, mput
), it is possible for an exception to
occur after part of the request is completed.
If such a condition occurs, a PartialSuccessException
is thrown containing the partial results.
See Section 15.6, “FTP Outbound Gateway” and Section 27.8, “SFTP Outbound Gateway” for more information.
A delegating session factory is now available, enabling the selection of a particular session factory based on some thread context value.
See Section 15.3, “Delegating Session Factory” and Section 27.3, “Delegating Session Factory” for more information.
Previously, the DefaultSftpSessionFactory
unconditionally allowed connections to unknown hosts.
This is now configurable (default false).
The factory now requires a configured knownHosts
file unless the allowUnknownKeys
property is true
(default
false).
See Section 27.2.1, “Configuration Properties” for more information.
The MessageSessionCallback<F, T>
has been introduced to perform any custom Session
operation(s) with the
requestMessage
context in the <int-(s)ftp:outbound-gateway/>
.
See Section 15.9, “MessageSessionCallback” and Section 27.10, “MessageSessionCallback” for more information.
WebSocketHandlerDecoratorFactory
support has been added to the ServerWebSocketContainer
to allow chained customization for the internal WebSocketHandler
.
See Section 33.5, “WebSockets Namespace Support” for more information.
The ApplicationEvent
adapters can now operate with payload
as event
directly allow omitting custom
ApplicationEvent
extensions.
The publish-payload
boolean attribute has been introduced on the <int-event:outbound-channel-adapter>
for this
purpose.
See Chapter 12, Spring ApplicationEvent Support for more information.