1. What's new in Spring Integration 4.0?

This chapter provides an overview of the new features and improvements that have been introduced with Spring Integration 4.0. If you are interested in more details, please see the Issue Tracker tickets that were resolved as part of the 4.0 development process.

Please be sure to also see the Migration Guide for important changes that might affect your applications. Migration guides for all versions back to 2.1 can be found on the Wiki.

1.1 New Components

1.1.1 MQTT Channel Adapters

The MQTT channel adapters (previously available in the Spring Integration Extensions repository) are now available as part of the normal Spring Integration distribution. See Chapter 22, MQTT Support

1.1.2 @EnableIntegration

The @EnableIntegration annotation has been added, to permit declaration of standard Spring Integration beans when using @Configuration classes. See Section 2.5, “Configuration” for more information.

1.1.3 @IntegrationComponentScan

The @IntegrationComponentScan annotation has been added, to permit classpath scanning for Spring Integration specific components. See Section 2.5, “Configuration” for more information.

1.1.4 @EnableMessageHistory

Message history can now be enabled with the @EnableMessageHistory annotation in a @Configuration class; in addition the message history settings can be modified by a JMX MBean. In addition auto-created MessageHandlers for annotated endpoints (e.g. @ServiceActivator, @Splitter etc.) now are also trackable by MessageHistory. For more information, see Section 8.2, “Message History”.

1.1.5 @MessagingGateway

Messaging gateway interfaces can now be configured with the @MessagingGateway annotation. It is an analogue of the <int:gateway/> xml element. For more information, see Section 7.2.6, “@MessagingGateway Annotation”.

1.1.6 Spring Boot @EnableAutoConfiguration

As well as the @EnableIntegration annotation mentioned above, a a hook has been introduced to allow the Spring Integration infrastructure beans to be configured using Spring Boot's @EnableAutoConfiguration. For more information see Spring Boot - AutoConfigure.

1.1.7 @GlobalChannelInterceptor

As well as the @EnableIntegration annotation mentioned above, the @GlobalChannelInterceptor annotation has bean introduced. For more information, see Section 2.5, “Configuration”.

1.1.8 @IntegrationConverter

The @IntegrationConverter annotation has bean introduced, as an analogue of <int:converter/> component. For more information, see Section 2.5, “Configuration”.

1.1.9 @EnablePublisher

The @EnablePublisher annotation has been added, to allow the specification of a default-publisher-channel for @Publisher annotations. See Section 2.5, “Configuration” for more information.

1.1.10 Redis Channel Message Stores

A new Redis MessageGroupStore, that is optimized for use when backing a QueueChannel for persistence, is now provided. For more information, see Section 23.4.1, “Redis Channel Message Stores”.

A new Redis ChannelPriorityMessageStore is now provided. This can be used to retrieve messages by priority. For more information, see Section 23.4.1, “Redis Channel Message Stores”.

1.1.11 MongodDB Channel Message Store

MongoDB support now provides the MongoDbChannelMessageStore - a channel specific MessageStore implementation. With priorityEnabled = true, it can be used in <int:priority-queue>s to achieve priority order polling of persisted messages. For more information see Section 21.3.1, “MongodDB Channel Message Store”.

1.1.12 @EnableIntegrationMBeanExport

The IntegrationMBeanExporter can now be enabled with the @EnableIntegrationMBeanExport annotation in a @Configuration class. For more information, see Section 8.1.7, “MBean Exporter”.

1.1.13 ChannelSecurityInterceptorFactoryBean

Configuration of Spring Security for message channels using @Configuration classes is now supported by using a ChannelSecurityInterceptorFactoryBean. For more information, see Appendix D, Security in Spring Integration.

1.1.14 Redis Command Gateway

The Redis support now provides the <outbound-gateway> component to perform generic Redis commands using the RedisConnection#execute method. For more information, see Section 23.8, “Redis Outbound Command Gateway”.

1.1.15 RedisLockRegistry and GemfireLockRegistry

The RedisLockRegistry and GemfireLockRegistry are now available supporting global locks visible to multiple application instances/servers. These can be used with aggregating message handlers across multiple application instances such that group release will occur on only one instance. For more information, see Section 23.9, “Redis Lock Registry”, Section 15.6, “Gemfire Lock Registry” and Section 5.4, “Aggregator”.

1.1.16 @Poller

Annotation-based messaging configuration can now have a poller attribute. This means that methods annotated with (@ServiceActivator, @Aggregator etc.) can now use an inputChannel that is a reference to a PollableChannel. For more information, see Section F.5, “Annotation Support”.

1.1.17 @InboundChannelAdapter and SmartLifecycle for Annotated Endpoints

The @InboundChannelAdapter method annotation is now available. It is an analogue of the <int:inbound-channel-adapter> XML component. In addition, all Messaging Annotations now provide SmartLifecycle options. For more information, see Section F.5, “Annotation Support”.

1.1.18 Twitter Search Outbound Gateway

A new twitter endpoint <int-twitter-search-outbound-gateway/> has been added. Unlike the search inbound adapter which polls using the same search query each time, the outbound gateway allows on-demand customized queries. For more information, see Section 30.6, “Twitter Search Outbound Gateway”.

1.1.19 Gemfire Metadata Store

The GemfireMetadataStore is provided, allowing it to be used, for example, in a AbstractPersistentAcceptOnceFileListFilter implementation in a multiple application instance/server environment. For more information, see Section 8.4, “Metadata Store”, Section 13.2, “Reading Files”, Section 14.3, “FTP Inbound Channel Adapter” and Section 26.5, “SFTP Inbound Channel Adapter”.

1.2 General Changes

1.2.1 Requires Spring Framework 4.0

Core messaging abstractions (Message, MessageChannel etc) have moved to the Spring Framework spring-messaging module. Users who reference these classes directly in their code will need to make changes as described in the first section of the Migration Guide.

1.2.2 Header Type for XPath Header Enricher

The header-type attribute has been introduced for the header sub-element of the <int-xml:xpath-header-enricher>. This attribute provides the target type for the header value to which the result of the XPath expression evaluation will be converted. For more information see Section 32.7, “XPath Header Enricher”.

1.2.3 Object To Json Transformer: Node Result

The result-type attribute has been introduced for the <int:object-to-json-transformer>. This attribute provides the target type for the result of object mapping to JSON. It supports STRING (default) and NODE. For more information see the section called “Configuring Transformer with XML”.

1.2.4 JMS Header Mapping

The DefaultJmsHeaderMapper now maps an incoming JMSPriority header to the Spring Integration priority header. Previously priority was only considered for outbound messages. For more information see Section 19.6, “Mapping Message Headers to/from JMS Message”.

1.2.5 JMS Outbound Channel Adapter

The JMS outbound channel adapter now supports the session-transacted attribute (default false). Previously, you had to inject a customized JmsTemplate to use transactions. See Section 19.3, “Outbound Channel Adapter”.

1.2.6 JMS Inbound Channel Adapter

The JMS inbound channel adapter now supports the session-transacted attribute (default false). Previously, you had to inject a customized JmsTemplate to use transactions (the adapter allowed 'transacted' in the acknowledgeMode which was incorrect, and didn't work; this value is no longer allowed). See Section 19.1, “Inbound Channel Adapter”.

1.2.7 Datatype Channels

You can now specify a MessageConverter to be used when converting (if necessary) payloads to one of the accepted datatypes in a Datatype channel. For more information see the section called “Datatype Channel Configuration”.

1.2.8 Simpler Retry Advice Configuration

Simplified namespace support has been added to configure a RequestHandlerRetryAdvice. For more information see the section called “Configuring the Retry Advice”.

1.2.9 Correlation Endpoint: Time-based Release Strategy

The mutually exclusive group-timeout and group-timeout-expression attributes have been added to the <int:aggregator> and <int:resequencer>. These attributes allow forced completion of a partial MessageGroup, if the ReleaseStrategy does not release a group and no further messages arrive within the time specified. For more information see Section 5.4.4, “Configuring an Aggregator”.

1.2.10 Redis Metadata Store

The RedisMetadataStore now implements ConcurrentMetadataStore, allowing it to be used, for example, in a AbstractPersistentAcceptOnceFileListFilter implementation in a multiple application instance/server environment. For more information, see Section 23.5, “Redis Metadata Store”, Section 13.2, “Reading Files”, Section 14.3, “FTP Inbound Channel Adapter” and Section 26.5, “SFTP Inbound Channel Adapter”.

1.2.11 JdbcChannelMessageStore and PriorityChannel

The JdbcChannelMessageStore now implements PriorityCapableChannelMessageStore, allowing it to be used as a message-store reference for priority-queues. For more information, see Section 17.4.2, “Backing Message Channels”.

1.2.12 AMQP Endpoints Delivery Mode

Spring AMQP, by default, creates persistent messages on the broker. This behavior can be overridden by setting the amqp_deliveryMode header and/or customizing the mappers. A convenient default-delivery-mode attribute has now been added to the adapters to provide easier configuration of this important setting. For more information, see Section 10.3, “Outbound Channel Adapter” and Section 10.5, “Outbound Gateway”.