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.
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
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.
The @IntegrationComponentScan
annotation has been added, to permit classpath
scanning for Spring Integration specific components.
See Section 2.5, “Configuration” for more information.
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 MessageHandler
s for
annotated endpoints (e.g. @ServiceActivator
, @Splitter
etc.)
now are also trackable by MessageHistory
. For more information, see Section 8.2, “Message History”.
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”.
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.
As well as the @EnableIntegration
annotation mentioned above,
the @GlobalChannelInterceptor
annotation has bean introduced.
For more information, see Section 2.5, “Configuration”.
The @IntegrationConverter
annotation has bean introduced,
as an analogue of <int:converter/>
component.
For more information, see Section 2.5, “Configuration”.
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.
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”.
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”.
The IntegrationMBeanExporter
can now be enabled with the @EnableIntegrationMBeanExport
annotation in a @Configuration
class. For more information, see Section 8.1.7, “MBean Exporter”.
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.
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”.
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”.
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”.
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”.
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”.
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”.
Annotation and Java configuration has introduced @BridgeFrom
and
@BridgeTo
@Bean
method annotations to mark
MessageChannel
beans in
@Configuration
classes.
For more information, see Section F.5, “Annotation Support”.
Messaging Annotations (@ServiceActivator
, @Router
,
@MessagingGateway
etc.) can now be configured as meta-annotations for user-defined
Messaging Annotations. In addition the user-defined annotations can have the same attributes
(inputChannel
, @Poller
, autoStartup
etc.).
For more information, see Section F.5, “Annotation Support”.
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.
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”.
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”.
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”.
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”.
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”.
You can now specify a MessageConverter
to be used when converting
(if necessary) payloads to one of the accepted datatype
s in a Datatype channel.
For more information see the section called “Datatype Channel Configuration”.
Simplified namespace support has been added to configure a
RequestHandlerRetryAdvice
.
For more information see the section called “Configuring the Retry Advice”.
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”.
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”.
The JdbcChannelMessageStore
now implements
PriorityCapableChannelMessageStore
, allowing it to be used as
a message-store
reference for priority-queue
s.
For more information, see Section 17.4.2, “Backing Message Channels”.
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.5, “Outbound Channel Adapter” and
Section 10.6, “Outbound Gateway”.
The DefaultFtpSessionFactory
now exposes the
connectTimeout
, defaultTimeout
and dataTimeout
properties, avoiding the need to subclass the factory just to set these common
properties. The postProcess*
methods are still available for more
advanced configuration. See Section 14.2, “FTP Session Factory” for more information.
The StatusUpdatingMessageHandler
(<int-twitter:outbound-channel-adapter>
)
now supports the tweet-data-expression
attribute to build a
org.springframework.social.twitter.api.TweetData
object for updating the
timeline status allowing, for example, attaching an image.
See Section 30.5.1, “Twitter Outbound Update Channel Adapter” for more information.
The id-expression
attribute has been introduced for
<int-jpa:retrieving-outbound-gateway>
to perform
EntityManager.find(Class entityClass, Object primaryKey)
.
See Section 18.6.3, “Retrieving Outbound Gateway” for more information.
When one of the standard deserializers encounters a problem decoding the input stream to
a message, it will now emit a TcpDeserializationExceptionEvent
, allowing
applications to examine the data at the point the exception occurred.
See Section 29.5, “TCP Connection Events” for more information.
Messaging Annotations (@ServiceActivator
, @Router
,
@InboundChannelAdapter
etc.) can now be configured on @Bean
definitions in @Configuration
classes.
For more information, see Section F.5, “Annotation Support”.
Splitter
components now support an Iterator
as the result object
for producing output messages.
See Section 5.3, “Splitter” for more information.