-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spring Integration 4.0 to 4.1 Migration Guide
##Spring Framework 4.1 base line
Spring Integration 4.1 is based on Spring Framework 4.1 and isn't compatible with previous versions.
Some API has been moved to the Spring Messaging module and deprecated in Spring Integration, considering to be removed in future releases:
-
Payload,HeaderandHeadersannotations from theorg.springframework.integration.annotationpackage to respective annotations in theorg.springframework.messaging.handler.annotationpackage.
##Spring AMQP 1.4
Starting with version 1.4 Spring AMQP Framewrok has been improved to use Spring Messaging abstraction. Some API has been moved frm Spring Integration to Spring AMQP:
-
org.springframework.integration.amqp.AmqpHeaders->org.springframework.amqp.support.AmqpHeaders. The former isdeprecatednow and extends the last one for backward compatibility.
##Removal of deprecated API
- The
GatewayProxyFactoryBeanno longer provides the#methodexpression evaluation variable (which contained theMethodname) in favor of#gatewayMethod, which provides access to the entireMethodobject. - The
spring_reply_correlationandspring_reply_toAMQP header aren't mapped by default any more.
##Inbound Endpoints Lifecycle Phase
The default phase of SourcePollingChannelAdapterFactoryBean, AbstractPollingEndpoint, MessageProducerSupport, JmsMessageDrivenEndpoint has been changed to the Integer.MAX_VALUE / 2 instead of 0 before. The bigger phase value means that component will be started later and stopped earlier, than those who has less value. Previously, the same 0 default value caused an issue when Consumer Endpoint might be stopped on application stop before Inbound Endpoint and the "Dispatcher has no subscribers" exception has been thrown. The similar issue we might have in a case, when Inbound Endpoint has been started before a Consumer Endpoint. Hence we ended up with losing messages issue.
##JMX
- The
<int-jmx:mbean-exporter/>no longer supports ashutdown-executorattribute.
##(S)FTP
- The
SftpPersistentAcceptOnceFileListFilterusegetFilenameinstead ofgetLongname.
##HTTP
-
The
Content-Dispositionheader is now mapped as standard one usingDefaultHttpHeaderMapper. Previously it was mapped asuser-definedwith provided prefix,X-by default. -
Before Spring Integration 4.0 the
MessageHeaders.CONTENT_TYPEconstant had had a valuecontent-type. It was appropriate header name to be mapped to the HTTP headerContent-Type. But since migration to Spring MessagingMessageHeaders.CONTENT_TYPEconstant has a valuecontentType. It prevented to map Message header to the HTTP request properly. NowDefaultHttpHeaderMapperhas been changed to map HTTP request headerContent-Typeto/from theMessageHeaders.CONTENT_TYPE, if the default configuration is used. It allows to propagate Message state to the HTTP request automatically:
<int:chain>
<int:object-to-json-transformer/>
<int-http:outbound-gateway url="http://service"/>
</int:chain>##JMS
- Previously the
org.springframework.integration.jms.DefaultJmsHeaderMapperoverrode values, which had been able to be populated by theorg.springframework.jms.support.converter.MessageConverterin theorg.springframework.integration.jms.JmsMessageDrivenEndpointlogic. SinceMessageConverterresult has a precedence, which is closer to JMS, theDefaultJmsHeaderMappernow skips those customMessageHeaderswhich already has been populated by theMessageConverter.
##Feed
The spring-integration-feed module has been upgraded to the com.rometools:rome-fetcher:1.5.0. And now rome classes are under new packages, e.g. com.sun.syndication.feed.synd.SyndEntry -> com.rometools.rome.feed.synd.SyndEntry.
##TCP/IP
Previously, only writes after the first were buffered by Nagle's algorithm. This meant that a serializer (such as stx/etx) could perform multiple IOs when sending data. To avoid this, the TcpNetConnection now wraps the Socket's outputStream in a BufferedOutputStream. Starting with this version, custom org.springframework.core.serializer.Serializer s for the org.springframework.integration.ip.tcp.connection.ConnectionFactory must add objectOutputStream.flush(); at the end of its serialize() method.
Previously, the integrationConversionService has been registered in the application context only, when you define some custom Converter for the Spring Integration environment - <int:converter> or @IntegrationConverter. Since version 4.1 the Spring Integration introduces ToStringFriendlyJsonNodeToStringConverter to allow avoid .toString() call for the JsonPropertyAccessor.ToStringFriendlyJsonNode objec within SpEL expression or for the POJO method arguments.
Hence the integrationConversionService is registered automatically if Jackson is presented in the classpath. Having that any ConversionService injection must be marked with @Qualifier for appropriate instance in the aplication context. For example:
@Autowired
@Qualifier("mvcConversionService")
private ConfigurableConversionService conversionService;