Appendix H. Change History

H.1 Changes between 4.0 and 4.1

For an overview of the changes in Spring Integration 4.1 since version 4.0, please see Chapter 1, What's new in Spring Integration 4.1?.

H.2 Changes between 3.0 and 4.0

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.

H.2.1 New Components

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

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

@IntegrationComponentScan

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

@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”.

@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”.

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.

@GlobalChannelInterceptor

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

@IntegrationConverter

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

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

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

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

@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”.

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.

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

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.11, “Redis Lock Registry”, Section 15.6, “Gemfire Lock Registry” and Section 5.4, “Aggregator”.

@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”.

@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”.

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

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

@BridgeFrom and @BridgeTo Annotations

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

Meta Messaging Annotations

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

H.2.2 General Changes

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.

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 33.7, “XPath Header Enricher”.

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

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

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

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

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

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

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

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

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

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.5, “Outbound Channel Adapter” and Section 10.6, “Outbound Gateway”.

FTP Timeouts

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.

Twitter: StatusUpdatingMessageHandler

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.

JPA Retrieving Gateway: id-expression

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.

TCP Deserialization Events

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 on @Bean Definitions

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

H.3 Changes Between 2.2 and 3.0

H.3.1 New Components

HTTP Request Mapping

The HTTP module now provides powerful Request Mapping support for Inbound Endpoints. Class UriPathHandlerMapping was replaced by IntegrationRequestMappingHandlerMapping, which is registered under the bean name integrationRequestMappingHandlerMapping in the application context. Upon parsing of the HTTP Inbound Endpoint, a new IntegrationRequestMappingHandlerMapping bean is either registered or an existing bean is being reused. To achieve flexible Request Mapping configuration, Spring Integration provides the <request-mapping/> sub-element for the <http:inbound-channel-adapter/> and the <http:inbound-gateway/>. Both HTTP Inbound Endpoints are now fully based on the Request Mapping infrastructure that was introduced with Spring MVC 3.1. For example, multiple paths are supported on a single inbound endpoint. For more information see Section 16.4, “HTTP Namespace Support”.

Spring Expression Language (SpEL) Configuration

A new IntegrationEvaluationContextFactoryBean is provided to allow configuration of custom PropertyAccessors and functions for use in SpEL expressions throughout the framework. For more information see Appendix A, Spring Expression Language (SpEL).

SpEL Functions Support

To customize the SpEL EvaluationContext with static Method functions, the new <spel-function/> component is introduced. Two built-in functions are also provided (#jsonPath and #xpath). For more information see Section A.3, “SpEL Functions”.

SpEL PropertyAccessors Support

To customize the SpEL EvaluationContext with PropertyAccessor implementations the new <spel-property-accessors/> component is introduced. For more information see Section A.4, “PropertyAccessors”.

Redis: New Components

A new Redis-based MetadataStore implementation has been added. The RedisMetadataStore can be used to maintain state of a MetadataStore across application restarts. This new MetadataStore implementation can be used with adapters such as:

  • Twitter Inbound Adapters
  • Feed Inbound Channel Adapter

New queue-based components have been added. The <int-redis:queue-inbound-channel-adapter/> and the <int-redis:queue-outbound-channel-adapter/> components are provided to perform 'right pop' and 'left push' operations on a Redis List, respectively.

For more information see Chapter 23, Redis Support.

Header Channel Registry

It is now possible to instruct the framework to store reply and error channels in a registry for later resolution. This is useful for cases where the replyChannel or errorChannel might be lost; for example when serializing a message. See Section 6.2.2, “Header Enricher” for more information.

MongoDB support: New ConfigurableMongoDbMessageStore

In addition to the existing eMongoDbMessageStore, a new ConfigurableMongoDbMessageStore has been introduced. This provides a more robust and flexible implementation of MessageStore for MongoDB. It does not have backward compatibility, with the existing store, but it is recommended to use it for new applications. Existing applications can use it, but messages in the old store will not be available. See Chapter 21, MongoDb Support for more information.

Syslog Support

Building on the 2.2 SyslogToMapTransformer Spring Integration 3.0 now introduces UDP and TCP inbound channel adapters especially tailored for receiving SYSLOG messages. For more information, see Chapter 28, Syslog Support.

'Tail' Support

File 'tail'ing inbound channel adapters are now provided to generate messages when lines are added to the end of text files; see Section 13.2.1, “'Tail'ing Files”.

JMX Support

  • A new <int-jmx:tree-polling-channel-adapter/> is provided; this adapter queries the JMX MBean tree and sends a message with a payload that is the graph of objects that matches the query. By default the MBeans are mapped to primitives and simple Objects like Map, List and arrays - permitting simple transformation, for example, to JSON.
  • The IntegrationMBeanExporter now allows the configuration of a custom ObjectNamingStrategy using the naming-strategy attribute.

For more information, see Section 8.1, “JMX Support”.

TCP/IP Connection Events and Connection Management

TcpConnections now emit ApplicationEvents (specifically TcpConnectionEvents) when connections are opened, closed, or an exception occurs. This allows applications to be informed of changes to TCP connections using the normal Spring ApplicationListener mechanism.

AbstractTcpConnection has been renamed TcpConnectionSupport; custom connections that are subclasses of this class, can use its methods to publish events. Similarly, AbstractTcpConnectionInterceptor has been renamed to TcpConnectionInterceptorSupport.

In addition, a new <int-ip:tcp-connection-event-inbound-channel-adapter/> is provided; by default, this adapter sends all TcpConnectionEvents to a Channel.

Further, the TCP Connection Factories, now provide a new method getOpenConnectionIds(), which returns a list of identifiers for all open connections; this allows applications, for example, to broadcast to all open connections.

Finally, the connection factories also provide a new method closeConnection(String connectionId) which allows applications to explicitly close a connection using its ID.

For more information see Section 29.5, “TCP Connection Events”.

Inbound Channel Adapter Script Support

The <int:inbound-channel-adapter/> now supports <expression/> and <script/> sub-elements to create a MessageSource; see Section 3.3.3, “Channel Adapter Expressions and Scripts”.

Content Enricher: Headers Enrichment Support

The Content Enricher now provides configuration for <header/> sub-elements, to enrich the outbound Message with headers based on the reply Message from the underlying message flow. For more information see Section 6.2.3, “Payload Enricher”.

H.3.2 General Changes

Message ID Generation

Previously, message ids were generated using the JDK UUID.randomUUID() method. With this release, the default mechanism has been changed to use a more efficient algorithm which is significantly faster. In addition, the ability to change the strategy used to generate message ids has been added. For more information see the section called “Message ID Generation”.

<gateway> Changes

  • It is now possible to set common headers across all gateway methods, and more options are provided for adding, to the message, information about which method was invoked.
  • It is now possible to entirely customize the way that gateway method calls are mapped to messages.
  • The GatewayMethodMetadata is now public class and it makes possible flexibly to configure the GatewayProxyFactoryBean programmatically from Java code.

For more information see Section 7.2, “Messaging Gateways”.

HTTP Endpoint Changes

  • Outbound Endpoint 'encode-uri' - <http:outbound-gateway/> and <http:outbound-channel-adapter/> now provide an encode-uri attribute to allow disabling the encoding of the URI object before sending the request.
  • Inbound Endpoint 'merge-with-default-converters' - <http:inbound-gateway/> and <http:inbound-channel-adapter/> now have a merge-with-default-converters attribute to include the list of default HttpMessageConverters after the custom message converters.
  • 'If-(Un)Modified-Since' HTTP Headers - previously, 'If-Modified-Since' and 'If-Unmodified-Since' HTTP headers were incorrectly processed within from/to HTTP headers mapping in the DefaultHttpHeaderMapper. Now, in addition correcting that issue, DefaultHttpHeaderMapper provides date parsing from formatted strings for any HTTP headers that accept date-time values.
  • Inbound Endpoint Expression Variables - In addition to the existing #requestParams and #pathVariables, the <http:inbound-gateway/> and <http:inbound-channel-adapter/> now support additional useful variables: #matrixVariables, #requestAttributes, #requestHeaders and #cookies. These variables are available in both payload and header expressions.
  • Outbound Endpoint 'uri-variables-expression' - HTTP Outbound Endpoints now support the uri-variables-expression attribute to specify an Expression to evaluate a Map for all URI variable placeholders within URL template. This allows selection of a different map of expressions based on the outgoing message.

For more information see Chapter 16, HTTP Support.

Jackson Support (JSON)

  • A new abstraction for JSON conversion has been introduced. Implementations for Jackson 1.x and Jackson 2 are currently provided, with the version being determined by presence on the classpath. Previously, only Jackson 1.x was supported.
  • The ObjectToJsonTransformer and JsonToObjectTransformer now emit/consume headers containing type information.

For more information, see 'JSON Transformers' in Section 6.1, “Transformer”.

Chain Elements 'id' Attribute

Previously, the id attribute for elements within a <chain> was ignored and, in some cases, disallowed. Now, the id attribute is allowed for all elements within a <chain>. The bean names of chain elements is a combination of the surrounding chain's id and the id of the element itself. For example: 'fooChain$child.fooTransformer.handler'. For more information see Section 5.6, “Message Handler Chain”.

Aggregator 'empty-group-min-timeout' property

The AbstractCorrelatingMessageHandler provides a new property empty-group-min-timeout to allow empty group expiry to run on a longer schedule than expiring partial groups. Empty groups will not be removed from the MessageStore until they have not been modified for at least this number of milliseconds. For more information see Section 5.4.4, “Configuring an Aggregator”.

Persistent File List Filters (file, (S)FTP)

New FileListFilters that use a persistent MetadataStore are now available. These can be used to prevent duplicate files after a system restart. See Section 13.2, “Reading Files”, Section 14.3, “FTP Inbound Channel Adapter”, and Section 26.5, “SFTP Inbound Channel Adapter” for more information.

Scripting Support: Variables Changes

A new variables attribute has been introduced for scripting components. In addition, variable bindings are now allowed for inline scripts. See Section 7.6, “Groovy support” and Section 7.5, “Scripting support” for more information.

Direct Channel Load Balancing configuration

Previously, when configuring LoadBalancingStrategy on the channel's 'dispatcher' sub-element, the only available option was to use a pre-defined enumeration of values which did not allow one to set a custom implementation of the LoadBalancingStrategy. You can now use load-balancer-ref to provide a reference to a custom implementation of the LoadBalancingStrategy. For more information see the section called “DirectChannel”.

PublishSubscribeChannel Behavior

Previously, sending to a <publish-subscribe-channel/> that had no subscribers would return a false result. If used in conjunction with a MessagingTemplate, this would result in an exception being thrown. Now, the PublishSubscribeChannel has a property minSubscribers (default 0). If the message is sent to at least the minimum number of subscribers, the send is deemed to be successful (even if zero). If an application is expecting to get an exception under these conditions, set the minimum subscribers to at least 1.

FTP, SFTP and FTPS Changes

The FTP, SFTP and FTPS endpoints no longer cache sessions by default

The deprecated cached-sessions attribute has been removed from all endpoints. Previously, the embedded caching mechanism controlled by this attribute's value didn't provide a way to limit the size of the cache, which could grow indefinitely. The CachingConnectionFactory was introduced in release 2.1 and it became the preferred (and is now the only) way to cache sessions.

The CachingConnectionFactory now provides a new method resetCache(). This immediately closes idle sessions and causes in-use sessions to be closed as and when they are returned to the cache.

The DefaultSftpSessionFactory (in conjunction with a CachingSessionFactory) now supports multiplexing channels over a single SSH connection (SFTP Only).

FTP, SFTP and FTPS Inbound Adapters

Previously, there was no way to override the default filter used to process files retrieved from a remote server. The filter attribute determines which files are retrieved but the FileReadingMessageSource uses an AcceptOnceFileListFilter. This means that if a new copy of a file is retrieved, with the same name as a previously copied file, no message was sent from the adapter.

With this release, a new attribute local-filter allows you to override the default filter, for example with an AcceptAllFileListFilter, or some other custom filter.

For users that wish the behavior of the AcceptOnceFileListFilter to be maintained across JVM executions, a custom filter that retains state, perhaps on the file system, can now be configured.

Inbound Channel Adapters now support the preserve-timestamp attribute, which sets the local file modified timestamp to the timestamp from the server (default false).

FTP, SFTP and FTPS Gateways

  • The gateways now support the mv command, enabling the renaming of remote files.
  • The gateways now support recursive ls and mget commands, enabling the retrieval of a remote file tree.
  • The gateways now support put and mput commands, enabling sending file(s) to the remote server.
  • The local-filename-generator-expression attribute is now supported, enabling the naming of local files during retrieval. By default, the same name as the remote file is used.
  • The local-directory-expression attribute is now supported, enabling the naming of local directories during retrieval based on the remote directory.

Remote File Template

A new higher-level abstraction (RemoteFileTemplate) is provided over the Session implementations used by the FTP and SFTP modules. While it is used internally by endpoints, this abstraction can also be used programmatically and, like all Spring *Template implementations, reliably closes the underlying session while allowing low level access to the session when needed.

For more information, see Chapter 14, FTP/FTPS Adapters and Chapter 26, SFTP Adapters.

'requires-reply' Attribute for Outbound Gateways

All Outbound Gateways (e.g. <jdbc:outbound-gateway/> or <jms:outbound-gateway/>) are designed for 'request-reply' scenarios. A response is expected from the external service and will be published to the reply-channel, or the replyChannel message header. However, there are some cases where the external system might not always return a result, e.g. a <jdbc:outbound-gateway/>, when a SELECT ends with an empty ResultSet or, say, a Web Service is One-Way. An option is therefore needed to configure whether or not a reply is required. For this purpose, the requires-reply attribute has been introduced for Outbound Gateway components. In most cases, the default value for requires-reply is true and, if there is not any result, a ReplyRequiredException will be thrown. Changing the value to false means that, if an external service doesn't return anything, the message-flow will end at that point, similar to an Outbound Channel Adapter.

[Note]Note
The WebService outbound gateway has an additional attribute ignore-empty-responses; this is used to treat an empty String response as if no response was received. It is true by default but can be set to false to allow the application to receive an empty String in the reply message payload. When the attribute is true an empty string is treated as no response for the purposes of the requires-reply attribute. requires-reply is false by default for the WebService outbound gateway.

Note, the requiresReply property was previously present in the AbstractReplyProducingMessageHandler but set to false, and there wasn't any way to configure it on Outbound Gateways using the XML namespace.

[Important]Important
Previously, a gateway receiving no reply would silently end the flow (with a DEBUG log message); with this change an exception will now be thrown by default by most gateways. To revert to the previous behavior, set requires-reply to false.

AMQP Outbound Gateway Header Mapping

Previously, the <int-amqp:outbound-gateway/> mapped headers before invoking the message converter, and the converter could overwrite headers such as content-type. The outbound adapter maps the headers after the conversion, which means headers like content-type from the outbound Message (if present) are used.

Starting with this release, the gateway now maps the headers after the message conversion, consistent with the adapter. If your application relies on the previous behavior (where the converter's headers overrode the mapped headers), you either need to filter those headers (before the message reaches the gateway) or set them appropriately. The headers affected by the SimpleMessageConverter are content-type and content-encoding. Custom message converters may set other headers.

Stored Procedure Components Improvements

For more complex database-specific types, not supported by the standard CallableStatement.getObject method, 2 new additional attributes were introduced to the <sql-parameter-definition/> element with OUT-direction:

  • type-name
  • return-type

The row-mapper attribute of the Stored Procedure Inbound Channel Adapter <returning-resultset/> sub-element now supports a reference to a RowMapper bean definition. Previously, it contained just a class name (which is still supported).

For more information see Section 17.5, “Stored Procedures”.

Web Service Outbound URI Configuration

Web Service Outbound Gateway 'uri' attribute now supports <uri-variable/> substitution for all URI-schemes supported by Spring Web Services. For more information see Section 32.4, “Outbound URI Configuration”.

Redis Adapter Changes

  • The Redis Inbound Channel Adapter can now use a null value for serializer property, with the raw data being the message payload.
  • The Redis Outbound Channel Adapter now has the topic-expression property to determine the Redis topic against the Message at runtime.
  • The Redis Inbound Channel Adapter, in addition to the existing topics attribute, now has the topic-patterns attribute.

For more information, see Chapter 23, Redis Support.

Advising Filters

Previously, when a <filter/> had a <request-handler-advice-chain/>, the discard action was all performed within the scope of the advice chain (including any downstream flow on the discard-channel). The filter element now has an attribute discard-within-advice (default true), to allow the discard action to be performed after the advice chain completes. See Section 7.7.4, “Advising Filters”.

Advising Endpoints using Annotations

Request Handler Advice Chains can now be configured using annotations. See Section 7.7.5, “Advising Endpoints Using Annotations”.

ObjectToStringTransformer Improvements

This transformer now correctly transforms byte[] and char[] payloads to String. For more information see Section 6.1, “Transformer”.

JPA Support Changes

Payloads to persist or merge can now be of type java.lang.Iterable.

In that case, each object returned by the Iterable is treated as an entity and persisted or merged using the underlying EntityManager. NULL values returned by the iterator are ignored.

The JPA adapters now have additional attributes to optionally 'flush' and 'clear' entities from the associated persistence context after performing persistence operations.

Retrieving gateways had no mechanism to specify the first record to be retrieved which is a common use case. The retrieving gateways now support specifying this parameter using a first-result and first-result-expression attributes to the gateway definition. Section 18.6.3, “Retrieving Outbound Gateway”.

The JPA retrieving gateway and inbound adapter now have an attribute to specify the maximum number of results in a result set as an expression. In addition, the max-results attribute has been introduced to replace max-number-of-results, which has been deprecated. max-results and max-results-expression are used to provide the maximum number of results, or an expression to compute the maximum number of results, respectively, in the result set.

For more information see Chapter 18, JPA Support.

Delayer: delay expression

Previously, the <delayer> provided a delay-header-name attribute to determine the delay value at runtime. In complex cases it was necessary to precede the <delayer> with a <header-enricher>. Spring Integration 3.0 introduced the expression attribute and expression sub-element for dynamic delay determination. The delay-header-name attribute is now deprecated because the header evaluation can be specified in the expression. In addition, the ignore-expression-failures was introduced to control the behavior when an expression evaluation fails. For more information see Section 7.4, “Delayer”.

JDBC Message Store Improvements

Spring Integration 3.0 adds a new set of DDL scripts for MySQL version 5.6.4 and higher. Now MySQL supports fractional seconds and is thus improving the FIFO ordering when polling from a MySQL-based Message Store. For more information, please see Section 17.4.1, “The Generic JDBC Message Store”.

IMAP Idle Connection Exceptions

Previously, if an IMAP idle connection failed, it was logged but there was no mechanism to inform an application. Such exceptions now generate ApplicationEvents. Applications can obtain these events using an <int-event:inbound-channel-adapter> or any ApplicationListener configured to receive an ImapIdleExceptionEvent or one of its super classes.

Message Headers and TCP

The TCP connection factories now enable the configuration of a flexible mechanism to transfer selected headers (as well as the payload) over TCP. A new TcpMessageMapper enables the selection of the headers, and an appropriate (de)serializer needs to be configured to write the resulting Map to the TCP stream. A MapJsonSerializer is provided as a convenient mechanism to transfer headers and payload over TCP. For more information see Section 29.8.4, “Transferring Headers”.

JMS Message Driven Channel Adapter

Previously, when configuring a <message-driven-channel-adapter/>, if you wished to use a specific TaskExecutor, it was necessary to declare a container bean and provide it to the adapter using the container attribute. The task-executor is now provided, allowing it to be set directly on the adapter. This is in addition to several other container attributes that were already available.

RMI Inbound Gateway

The RMI Inbound Gateway now supports an error-channel attribute. See Section 25.3, “Inbound RMI”.

XsltPayloadTransformer

You can now specify the transformer factory class name using the transformer-factory-class attribute. See the section called “XsltPayloadTransformer”

H.4 Changes between 2.1 and 2.2

H.4.1 New Components

RedisStore Inbound and Outbound Channel Adapters

Spring Integration now has RedisStore Inbound and Outbound Channel Adapters allowing you to write and read Message payloads to/from Redis collection(s). For more information please see Section 23.7, “RedisStore Outbound Channel Adapter” and Section 23.6, “RedisStore Inbound Channel Adapter”.

MongoDB Inbound and Outbound Channel Adapters

Spring Integration now has MongoDB Inbound and Outbound Channel Adapters allowing you to write and read Message payloads to/from a MongoDB document store. For more information please see Section 21.5, “MongoDB Outbound Channel Adapter” and Section 21.4, “MongoDB Inbound Channel Adapter”.

JPA Endpoints

Spring Integration now includes components for the Java Persistence API (JPA) for retrieving and persisting JPA entity objects. The JPA Adapter includes the following components:

For more information please see Chapter 18, JPA Support

H.4.2 General Changes

Spring 3.1 Used by Default

Spring Integration now uses Spring 3.1.

Adding Behavior to Endpoints

The ability to add an <advice-chain/> to a poller has been available for some time. However, the behavior added by this affects the entire integration flow. It did not address the ability to add, say, retry, to an individual endpoint. The 2.2. release introduces the <request-handler-advice-chain/> to many endpoints.

In addition, 3 standard Advice classes have been provided for this purpose:

  • MessageHandlerRetryAdvice
  • MessageHandlerCircuitBreakerAdvice
  • ExpressionEvaluatingMessageHandlerAdvice

For more information, see Section 7.7, “Adding Behavior to Endpoints”.

Transaction Synchronization and Pseudo Transactions

Pollers can now participate in Spring's Transaction Synchronization feature. This allows for synchronizing such operations as renaming files by an inbound channel adapter depending on whether the transaction commits, or rolls back.

In addition, these features can be enabled when there is not a 'real' transaction present, by means of a PseudoTransactionManager.

For more information see Section C.3, “Transaction Synchronization”.

File Adapter - Improved File Overwrite/Append Handling

When using the File Oubound Channel Adapter or the File Outbound Gateway, a new mode property was added. Prior to Spring Integration 2.2, target files were replaced when they existed. Now you can specify the following options:

  • REPLACE (Default)
  • APPEND
  • FAIL
  • IGNORE

For more information please see Section 13.3.3, “Dealing with Existing Destination Files”.

Reply-Timeout added to more Outbound Gateways

The XML Namespace support adds the reply-timeout attribute to the following Outbound Gateways:

  • Amqp Outbound Gateway
  • File Outbound Gateway
  • Ftp Outbound Gateway
  • Sftp Outbound Gateway
  • Ws Outbound Gateway

Spring-AMQP 1.1

Spring Integration now uses Spring AMQP 1.1. This enables several features to be used within a Spring Integration application, including...

  • A fixed reply queue for the outbound gateway
  • HA (mirrored) queues
  • Publisher Confirms
  • Returned Messages
  • Support for Dead Letter Exchanges/Dead Letter Queues

JDBC Support - Stored Procedures Components

SpEL Support

When using the Stored Procedure components of the Spring Integration JDBC Adapter, you can now provide Stored Procedure Names or Stored Function Names using Spring Expression Language (SpEL).

This allows you to specify the Stored Procedures to be invoked at runtime. For example, you can provide Stored Procedure names that you would like to execute via Message Headers. For more information please see Section 17.5, “Stored Procedures”.

JMX Support

The Stored Procedure components now provide basic JMX support, exposing some of their properties as MBeans:

  • Stored Procedure Name
  • Stored Procedure Name Expression
  • JdbcCallOperations Cache Statistics

JDBC Support - Outbound Gateway

When using the JDBC Outbound Gateway, the update query is no longer mandatory. You can now provide solely a select query using the request message as a source of parameters.

JDBC Support - Channel-specific Message Store Implementation

A new Message Channel-specific Message Store Implementation has been added, providing a more scalable solution using database-specific SQL queries. For more information please see: Section 17.4.2, “Backing Message Channels”.

Orderly Shutdown

A method stopActiveComponents() has been added to the IntegrationMBeanExporter. This allows a Spring Integration application to be shut down in an orderly manner, disallowing new inbound messages to certain adapters and waiting for some time to allow in-flight messages to complete.

JMS Oubound Gateway Improvements

The JMS Outbound Gateway can now be configured to use a MessageListener container to receive replies. This can improve performance of the gateway.

object-to-json-transformer

The ObjectToJsonTransformer now sets the content-type header to application/json by default. For more information see Section 6.1, “Transformer”.

HTTP Support

Java serialization over HTTP is no longer enabled by default. Previously, when setting a expected-response-type to a Serializable object, the Accept header was not properly set up. The SerializingHttpMessageConverter has now been updated to set the Accept header to application/x-java-serialized-object. However, because this could cause incompatibility with existing applications, it was decided to no longer automatically add this converter to the HTTP endpoints.

If you wish to use Java serialization, you will need to add the SerializingHttpMessageConverter to the appropriate endpoints, using the message-converters attribute, when using XML configuration, or using the setMessageConverters() method.

Alternatively, you may wish to consider using JSON instead which is enabled by simply having Jackson on the classpath.

H.5 Changes between 2.0 and 2.1

H.5.1 New Components

JSR-223 Scripting Support

In Spring Integration 2.0, support for Groovy was added. With Spring Integration 2.1 we expanded support for additional languages substantially by implementing support for JSR-223 (Scripting for the Java™ Platform). Now you have the ability to use any scripting language that supports JSR-223 including:

  • Javascript
  • Ruby/JRuby
  • Python/Jython
  • Groovy

For further details please see Section 7.5, “Scripting support”.

GemFire Support

Spring Integration provides support for GemFire by providing inbound adapters for entry and continuous query events, an outbound adapter to write entries to the cache, and MessageStore and MessageGroupStore implementations. Spring integration leverages the Spring Gemfire project, providing a thin wrapper over its components.

For further details please see Chapter 15, GemFire Support.

AMQP Support

Spring Integration 2.1 adds several Channel Adapters for receiving and sending messages using the Advanced Message Queuing Protocol (AMQP). Furthermore, Spring Integration also provides a point-to-point Message Channel, as well as a publish/subscribe Message Channel that are backed by AMQP Exchanges and Queues.

For further details please see Chapter 10, AMQP Support.

MongoDB Support

As of version 2.1 Spring Integration provides support for MongoDB by providing a MongoDB-based MessageStore.

For further details please see Chapter 21, MongoDb Support.

Redis Support

As of version 2.1 Spring Integration supports Redis, an advanced key-value store, by providing a Redis-based MessageStore as well as Publish-Subscribe Messaging adapters.

For further details please see Chapter 23, Redis Support.

Support for Spring's Resource abstraction

As of version 2.1, we've introduced a new Resource Inbound Channel Adapter that builds upon Spring's Resource abstraction to support greater flexibility across a variety of actual types of underlying resources, such as a file, a URL, or a class path resource. Therefore, it's similar to but more generic than the File Inbound Channel Adapter.

For further details please see Section 24.2, “Resource Inbound Channel Adapter”.

Stored Procedure Components

With Spring Integration 2.1, the JDBC Module also provides Stored Procedure support by adding several new components, including inbound/outbound channel adapters and an Outbound Gateway. The Stored Procedure support leverages Spring's SimpleJdbcCall class and consequently supports stored procedures for:

  • Apache Derby
  • DB2
  • MySQL
  • Microsoft SQL Server
  • Oracle
  • PostgreSQL
  • Sybase

The Stored Procedure components also support Sql Functions for the following databases:

  • MySQL
  • Microsoft SQL Server
  • Oracle
  • PostgreSQL

For further details please see Section 17.5, “Stored Procedures”.

XPath and XML Validating Filter

Spring Integration 2.1 provides a new XPath-based Message Filter, that is part of the XML module. The XPath Filter allows you to filter messages using provided XPath Expressions. Furthermore, documentation was added for the XML Validating Filter.

For more details please see Section 33.8, “Using the XPath Filter” and Section 33.10, “XML Validating Filter”.

Payload Enricher

Since Spring Integration 2.1, the Payload Enricher is provided. A Payload Enricher defines an endpoint that typically passes a Message to the exposed request channel and then expects a reply message. The reply message then becomes the root object for evaluation of expressions to enrich the target payload.

For further details please see Section 6.2.3, “Payload Enricher”.

FTP and SFTP Outbound Gateways

Spring Integration 2.1 provides two new Outbound Gateways in order to interact with remote File Transfer Protocol (FTP) or Secure File Transfer Protocol (SFT) servers. These two gateways allow you to directly execute a limited set of remote commands.

For instance, you can use these Outbound Gateways to list, retrieve and delete remote files and have the Spring Integration message flow continue with the remote server's response.

For further details please see Section 14.5, “FTP Outbound Gateway” and Section 26.7, “SFTP Outbound Gateway”.

FTP Session Caching

As of version 2.1, we have exposed more flexibility with regards to session management for remote file adapters (e.g., FTP, SFTP etc).

Specifically, the cache-sessions attribute, which is available via the XML namespace support, is now deprecated. Alternatively, we added the sessionCacheSize and sessionWaitTimeout attributes on the CachingSessionFactory.

For further details please see Section 14.6, “FTP Session Caching” and Section 26.3, “SFTP Session Caching”.

H.5.2 Framework Refactoring

Standardizing Router Configuration

Router parameters have been standardized across all router implementations with Spring Integration 2.1 providing a more consistent user experience.

With Spring Integration 2.1 the ignore-channel-name-resolution-failures attribute has been removed in favor of consolidating its behavior with the resolution-required attribute. Also, the resolution-required attribute now defaults to true.

Starting with Spring Integration 2.1, routers will no longer silently drop any messages, if no default output channel was defined. This means, that by default routers now require at least one resolved channel (if no default-output-channel was set) and by default will throw a MessageDeliveryException if no channel was determined (or an attempt to send was not successful).

If, however, you do desire to drop messages silently, simply set default-output-channel="nullChannel".

[Important]Important
With the standardization of Router parameters and the consolidation of the parameters described above, there is the possibility of breaking older Spring Integration based applications.

For further details please see Section 5.1, “Routers”

XML Schemas updated to 2.1

Spring Integration 2.1 ships with an updated XML Schema (version 2.1), providing many improvements, e.g. the Router standardizations discussed above.

From now on, users must always declare the latest XML schema (currently version 2.1). Alternatively, they can use the version-less schema. Generally, the best option is to use version-less namespaces, as these will automatically use the latest available version of Spring Integration.

Declaring a version-less Spring Integration namespace:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:int="http://www.springframework.org/schema/integration"
   xsi:schemaLocation="http://www.springframework.org/schema/integration
           http://www.springframework.org/schema/integration/spring-integration.xsd
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd">
...
</beans>

Declaring a Spring Integration namespace using an explicit version:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:int="http://www.springframework.org/schema/integration"
   xsi:schemaLocation="http://www.springframework.org/schema/integration
           http://www.springframework.org/schema/integration/spring-integration-2.2.xsd
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd">
...
</beans>

The old 1.0 and 2.0 schemas are still there, but if an Application Context still references one of those deprecated schemas, the validator will fail on initialization.

H.5.3 Source Control Management and Build Infrastructure

Source Code now hosted on Github

Since version 2.0, the Spring Integration project uses Git for version control. In order to increase community visibility even further, the project was moved from SpringSource hosted Git repositories to Github. The Spring Integration Git repository is located at: https://github.com/SpringSource/spring-integration/

For the project we also improved the process of providing code contributions and we ensure that every commit is peer-reviewed. In fact, core committers now follow the same process as contributors. For more details please see:

https://github.com/SpringSource/spring-integration/wiki/Contributor-Guidelines

Improved Source Code Visibility with Sonar

In an effort to provide better source code visibility and consequently to monitor the quality of Spring Integration's source code, an instance of Sonar was setup and metrics are gathered nightly and made avaiblable at:

https://sonar.springsource.org/

H.5.4 New Samples

For the 2.1 release of Spring Integration we also expanded the Spring Integration Samples project and added many new samples, e.g. samples covering AMQP support, the new payload enricher, a sample illustrating techniques for testing Spring Integration flow fragments, as well as an example for executing Stored Procedures against Oracle. For details please visit:

https://github.com/SpringSource/spring-integration-samples

H.6 Changes between 1.0 and 2.0

For a detailed migration guide in regards to upgrading an existing application that uses Spring Integration older than version 2.0, please see:

http://www.springsource.org/node/2976

H.6.1 Spring 3 support

Spring Integration 2.0 is built on top of Spring 3.0.5 and makes many of its features available to our users.

Support for the Spring Expression Language (SpEL)

You can now use SpEL expressions within the transformer, router, filter, splitter, aggregator, service-activator, header-enricher, and many more elements of the Spring Integration core namespace as well as various adapters. There are many samples provided throughout this manual.

ConversionService and Converter

You can now benefit from Conversion Service support provided with Spring while configuring many Spring Integration components such as Datatype Channel. See Section 3.1.2, “Message Channel Implementations” as well Section 7.3.1, “Introduction”. Also, the SpEL support mentioned in the previous point also relies upon the ConversionService. Therefore, you can register Converters once, and take advantage of them anywhere you are using SpEL expressions.

TaskScheduler and Trigger

Spring 3.0 defines two new strategies related to scheduling: TaskScheduler and Trigger Spring Integration (which uses a lot of scheduling) now builds upon these. In fact, Spring Integration 1.0 had originally defined some of the components (e.g. CronTrigger) that have now been migrated into Spring 3.0's core API. Now, you can benefit from reusing the same components within the entire Application Context (not just Spring Integration configuration). Configuration of Spring Integration Pollers has been greatly simplified as well by providing attributes for directly configuring rates, delays, cron expressions, and trigger references. See Section 3.3, “Channel Adapter” for sample configurations.

RestTemplate and HttpMessageConverter

Our outbound HTTP adapters now delegate to Spring's RestTemplate for executing the HTTP request and handling its response. This also means that you can reuse any custom HttpMessageConverter implementations. See Section 16.3, “Http Outbound Gateway” for more details.

H.6.2 Enterprise Integration Pattern Additions

Also in 2.0 we have added support for even more of the patterns described in Hohpe and Woolf's Enterprise Integration Patterns book.

Message History

We now provide support for the Message History pattern allowing you to keep track of all traversed components, including the name of each channel and endpoint as well as the timestamp of that traversal. See Section 8.2, “Message History” for more details.

Message Store

We now provide support for the Message Store pattern. The Message Store provides a strategy for persisting messages on behalf of any process whose scope extends beyond a single transaction, such as the Aggregator and Resequencer. Many sections of this document provide samples on how to use a Message Store as it affects several areas of Spring Integration. See Section 8.3, “Message Store”, Section 6.3, “Claim Check”, Section 3.1, “Message Channels”, Section 5.4, “Aggregator”, Chapter 17, JDBC Support, and Section 5.5, “Resequencer” for more details

Claim Check

We have added an implementation of the Claim Check pattern. The idea behind the Claim Check pattern is that you can exchange a Message payload for a "claim ticket" and vice-versa. This allows you to reduce bandwidth and/or avoid potential security issues when sending Messages across channels. See Section 6.3, “Claim Check” for more details.

Control Bus

We have provided implementations of the Control Bus pattern which allows you to use messaging to manage and monitor endpoints and channels. The implementations include both a SpEL-based approach and one that executes Groovy scripts. See Section 8.5, “Control Bus” and Section 7.6.2, “Control Bus” for more details.

H.6.3 New Channel Adapters and Gateways

We have added several new Channel Adapters and Messaging Gateways in Spring Integration 2.0.

TCP/UDP Adapters

We have added Channel Adapters for receiving and sending messages over the TCP and UDP internet protocols. See Chapter 29, TCP and UDP Support for more details. Also, you can checkout the following blog: TCP/UDP support

Twitter Adapters

Twitter adapters provides support for sending and receiving Twitter Status updates as well as Direct Messages. You can also perform Twitter Searches with an inbound Channel Adapter. See Chapter 30, Twitter Support for more details.

XMPP Adapters

The new XMPP adapters support both Chat Messages and Presence events. See Chapter 34, XMPP Support for more details.

FTP/FTPS Adapters

Inbound and outbound File transfer support over FTP/FTPS is now available. See Chapter 14, FTP/FTPS Adapters for more details.

SFTP Adapters

Inbound and outbound File transfer support over SFTP is now available. See Chapter 26, SFTP Adapters for more details.

Feed Adapters

We have also added Channel Adapters for receiving news feeds (ATOM/RSS). See Chapter 12, Feed Adapter for more details.

H.6.4 Other Additions

Groovy Support

With Spring Integration 2.0 we've added Groovy support allowing you to use Groovy scripting language to provide integration and/or business logic. See Section 7.6, “Groovy support” for more details.

Map Transformers

These symmetrical transformers convert payload objects to and from a Map. See Section 6.1, “Transformer” for more details.

JSON Transformers

These symmetrical transformers convert payload objects to and from JSON. See Section 6.1, “Transformer” for more details.

Serialization Transformers

These symmetrical transformers convert payload objects to and from byte arrays. They also support the Serializer and Deserializer strategy interfaces that have been added as of Spring 3.0.5. See Section 6.1, “Transformer” for more details.

H.6.5 Framework Refactoring

The core API went through some significant refactoring to make it simpler and more usable. Although we anticipate that the impact to the end user should be minimal, please read through this document to find what was changed. Especially, visit Section 5.1.5, “Dynamic Routers” , Section 7.2, “Messaging Gateways”, Section 16.3, “Http Outbound Gateway”, Section 4.1, “Message”, and Section 5.4, “Aggregator” for more details. If you are depending directly on some of the core components (Message, MessageHeaders, MessageChannel, MessageBuilder, etc.), you will notice that you need to update any import statements. We restructured some packaging to provide the flexibility we needed for extending the domain model while avoiding any cyclical dependencies (it is a policy of the framework to avoid such "tangles").

H.6.6 New Source Control Management and Build Infrastructure

With Spring Integration 2.0 we have switched our build environment to use Git for source control. To access our repository simply follow this URL: http://git.springsource.org/spring-integration. We have also switched our build system to Gradle.

H.6.7 New Spring Integration Samples

With Spring Integration 2.0 we have decoupled the samples from our main release distribution. Please read this blog to get more info New Spring Integration Samples We have also created many new samples, including samples for every new Adapter.

H.6.8 SpringSource Tool Suite Visual Editor for Spring Integration

There is an amazing new visual editor for Spring Integration included within the latest version of SpringSource Tool Suite. If you are not already using STS, please download it here:

http://www.springsource.com/landing/best-development-tool-enterprise-java