Changes between 4.1 and 4.2

See the Migration Guide for important changes that might affect your applications. You can find migration guides for all versions back to 2.1 on the wiki.

New Components

Version 4.2 added a number of new components.

Major Management/JMX Rework

We added a new MetricsFactory strategy interface. This change, 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 Metrics and Management and JMX Improvements.

MongoDB Metadata Store

The MongoDbMetadataStore is now available. For more information, see MongoDB Metadata Store.

SecuredChannel Annotation

We introduced the @SecuredChannel annotation, replacing the deprecated ChannelSecurityInterceptorFactoryBean. For more information, see Security in Spring Integration.

SecurityContext Propagation

We introduced the SecurityContextPropagationChannelInterceptor for the SecurityContext propagation from one message flow’s thread to another. For more information, see Security in Spring Integration.

FileSplitter

In 4.1.2, we added FileSplitter, which splits text files into lines. It now has full support in the int-file: namespace. See File Splitter for more information.

Zookeeper Support

We added Zookeeper support to the framework to assist when running on a clustered or multi-host environment. The change impacts the following features:

  • ZookeeperMetadataStore

  • ZookeeperLockRegistry

  • Zookeeper Leadership

See Zookeeper Support for more information.

Thread Barrier

A new thread <int:barrier/> component is available, letting a thread be suspended until some asynchronous event occurs. See Thread Barrier for more information.

STOMP Support

We added STOMP support to the framework as an inbound and outbound channel adapters pair. See STOMP Support for more information.

Codec

A new Codec abstraction has been introduced, to encode and decode objects to and from byte[]. We added an implementation that uses Kryo. We also added codec-based transformers and message converters. See Codec for more information.

Message PreparedStatement Setter

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 using SqlParameterSourceFactory to populate parameters on the PreparedStatement with the requestMessage context. See Outbound Channel Adapter for more information.

General Changes

This section describes general changes from version 4.1 to version 4.2.

WireTap

As an alternative to the existing selector attribute, the <wire-tap/> element now supports the selector-expression attribute.

File Changes

See File Support for more information about these changes.

Appending New Lines

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.

Ignoring Hidden Files

We added the ignore-hidden attribute for the <int-file:inbound-channel-adapter> to let you set whether to pick up hidden files from the source directory. It defaults to true.

Writing InputStream Payloads

The FileWritingMessageHandler now also accepts InputStream as a valid message payload type.

HeadDirectoryScanner

You can now use the HeadDirectoryScanner with other FileListFilter implementations.

Last Modified Filter

We added the LastModifiedFileListFilter.

Watch Service Directory Scanner

We added the WatchServiceDirectoryScanner.

Persistent File List Filter Changes

The AbstractPersistentFileListFilter has a new property (flushOnUpdate) which, when set to true, calls flush() on the metadata store if it implements Flushable (for example, PropertiesPersistingMetadataStore).

Class Package Change

We moved the ScatterGatherHandler class from the org.springframework.integration.handler to the org.springframework.integration.scattergather.

TCP Changes

This section describes general changes to the Spring Integration TCP functionality.

TCP Serializers

The TCP Serializers no longer flush() the OutputStream. This is now done by the TcpNxxConnection classes. If you use the serializers directly within your code, you may have to flush() the OutputStream.

Server Socket Exceptions

TcpConnectionServerExceptionEvent instances are now published whenever an unexpected exception occurs on a TCP server socket (also added to 4.1.3 and 4.0.7). See TCP Connection Events for more information.

TCP Server Port

If you configure a TCP server socket factory to listen on a random port, you can now obtain the actual port chosen by the OS by using getPort(). getServerSocketAddress() is also available.

See "TCP Connection Factories" for more information.

TCP Gateway Remote Timeout

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 .TCP Outbound Gateway Attributes for more information.

TCP SSLSession Available for Header Mapping

TcpConnection implementations now support getSslSession() to let you extract information from the session to add to message headers. See IP Message Headers for more information.

TCP Events

New events are now published whenever a correlation exception occurs — such as sending a message to a non-existent socket.

The TcpConnectionEventListeningMessageProducer is deprecated. Use the generic event adapter instead.

See TCP Connection Events for more information.

@InboundChannelAdapter Changes

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/>, which defaults to 1. The annotation now defaults this attribute to 1.

API Changes

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 need to change the import.

Reactor is still supported for functionality such as the Promise gateway. The dependency was removed for those users who do not need it.

JMS Changes

This section describes general changes to the Spring Integration TCP functionality.

Reply Listener Lazy Initialization

You can now 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 Outbound Gateway for more information.

Conversion Errors in Message-Driven Endpoints

The error-channel is now used for the conversion errors. In previous versions, they caused transaction rollback and message redelivery.

See Message-driven Channel Adapter and Inbound Gateway for more information.

Default Acknowledge Mode

When using an implicitly defined DefaultMessageListenerContainer, the default acknowledge is now transacted. We recommend using transacted 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 Message-driven Channel Adapter and Inbound Gateway for more information.

Shared Subscriptions

We added Namespace support for shared subscriptions (JMS 2.0) to message-driven endpoints and the <int-jms:publish-subscribe-channel>. Previously, you had to wire up listener containers as <bean/> declarations to use shared connections.

See JMS Support for more information.

Conditional Pollers

We now provide much more flexibility for dynamic polling.

See Conditional Pollers for Message Sources for more information.

AMQP Changes

This section describes general changes to the Spring Integration AMQP functionality.

Publisher Confirmations

The <int-amqp:outbound-gateway> now supports confirm-correlation-expression, confirm-ack-channel, and confirm-nack-channel attributes (which have a purpose similar to that of <int-amqp:outbound-channel-adapter>).

Correlation Data

For both the outbound channel adapter and the inbound gateway, if the correlation data is a Message<?>, it becomes the basis of the message on the ack or nack channel, with the additional header(s) added. Previously, any correlation data (including Message<?>) was returned as the payload of the ack or nack message.

Inbound Gateway Properties

The <int-amqp:inbound-gateway> now exposes the amqp-template attribute to allow more control over an external bean for the reply RabbitTemplate. You can also provide your own AmqpTemplate implementation. In addition, you can use default-reply-to if the request message does not have a replyTo property.

See AMQP Support for more information.

XPath Splitter Improvements

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 Splitting XML Messages for more information.

HTTP Changes

This section describes general changes to the Spring Integration HTTP functionality.

CORS

The HTTP inbound endpoints (<int-http:inbound-channel-adapter> and <int-http:inbound-gateway>) now allow the configuration of Cross-origin Resource Sharing (CORS).

Inbound Gateway Timeout

You can configure the HTTP inbound gate way to return a status code that you specify when a request times out. The default is now 500 Internal Server Error instead of 200 OK.

See Response Status Code for more information.

Form Data

We added documentation for proxying multipart/form-data requests. See HTTP Support for more information.

Gateway Changes

This section describes general changes to the Spring Integration Gateway functionality.

[[gateway-methods-can-return-completablefuture<?>]] ==== Gateway Methods can Return CompletableFuture<?>

When using Java 8, gateway methods can now return CompletableFuture<?>. See CompletableFuture for more information.

MessagingGateway Annotation

The request and reply timeout properties are now String instead of Long to allow configuration with property placeholders or SpEL. See @MessagingGateway Annotation.

Aggregator Changes

This section describes general changes to the Spring Integration aggregator functionality.

Aggregator Performance

This release includes some performance improvements for aggregating components (aggregator, resequencer, and others), 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, the JDBC, Redis, and MongoDB message stores support this property.

Output Message Group Processor

When using a ref or inner bean for the aggregator, you can now directly bind a MessageGroupProcessor. In addition, we added a SimpleMessageGroupProcessor that 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, where messages are held up until they all arrive and are then released individually. See Aggregator for more information.

FTP and SFTP Changes

This section describes general changes to the Spring Integration FTP and SFTP functionality.

Inbound Channel Adapters

You can now specify a remote-directory-expression on the inbound channel adapters, to determine the directory at runtime. See FTP/FTPS Adapters and SFTP Adapters for more information.

Gateway Partial Results

When you use FTP or SFTP outbound gateways to operate on multiple files (with mget and mput), an exception can occur after part of the request is completed. If such a condition occurs, a PartialSuccessException that contains the partial results is thrown. See FTP Outbound Gateway and SFTP Outbound Gateway for more information.

Delegating Session Factory

We added a delegating session factory, enabling the selection of a particular session factory based on some thread context value.

Default Sftp Session Factory

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).

Message Session Callback

We introduced the MessageSessionCallback<F, T> to perform any custom Session operations with the requestMessage context in the <int-(s)ftp:outbound-gateway/>.

Websocket Changes

We added WebSocketHandlerDecoratorFactory support to the ServerWebSocketContainer to allow chained customization for the internal WebSocketHandler. See WebSockets Namespace Support for more information.

Application Event Adapters changes

The ApplicationEvent adapters can now operate with payload as an event to directly allow omitting custom ApplicationEvent extensions. For this purpose, we introduced the publish-payload boolean attribute has been introduced on the <int-event:outbound-channel-adapter>. See Spring ApplicationEvent Support for more information.