[[migration-5.1-5.2]]
=== Changes between 5.1 and 5.2

[[x5.2-package-class]]
=== Package and Class Changes

`Pausable` has been moved from `o.s.i.endpoint` to `o.s.i.core`.

[[x5.2-behavior]]
=== Behavior Changes

See the https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-5.1-to-5.2-Migration-Guide[Migration Guide] about behavior changes in this version.

[[x5.2-new-components]]
=== New Components

[[x5.2-rsocket-support]]
==== RSocket Support

The `spring-integration-rsocket` module is now available with channel adapter implementations for RSocket protocol support.
See <<./rsocket.adoc#rsocket,RSocket Support>> for more information.

[[x5.2-rate-limit-advice]]
==== Rate Limit Advice Support

The `RateLimiterRequestHandlerAdvice` is now available for limiting requests rate on handlers.
See <<./handler-advice.adoc#rate-limiter-advice,Rate Limiter Advice>> for more information.

[[x5.2-cache-advice]]
==== Caching Advice Support

The `CacheRequestHandlerAdvice` is now available for caching request results on handlers.
See <<./handler-advice.adoc#cache-advice,Caching Advice>> for more information.

[[x5.2-kotlin-scripts]]
==== Kotlin Scripts Support

The JSR223 scripting module now includes a support for Kotlin scripts.
See <<./scripting.adoc#scripting,Scripting Support>> for more information.

[[x5.2-flux-aggregator]]
==== Flux Aggregator Support

The `FluxAggregatorMessageHandler` is now available for grouping and windowing messages logic based on the Project Reactor `Flux` operators.
See <<./aggregator.adoc#flux-aggregator,Flux Aggregator>> for more information.

[[x5.2-sftp-events]]
==== FTP/SFTP Event Publisher

The FTP and SFTP modules now provide an event listener for certain Apache Mina FTP/SFTP server events.
See <<./ftp.adoc#ftp-server-events, Apache Mina FTP Server Events>> and <<./sftp.adoc#sftp-server-events, Apache Mina SFTP Server Events>> for more information.

[[x5.2-avro]]
==== Avro Transformers

Simple Apache Avro transformers are now provided.
See <<./transformers.adoc#avro-transformers, Avro Transformers>> for more information.

[[x5.2-general]]
=== General Changes

The `JsonToObjectTransformer` now supports generics for the target object to deserialize into.
See <<./transformer.adoc#json-transformers,JSON Transformers>> for more information.

The `splitter` now supports a `discardChannel` configuration option.
See <<./splitter.adoc#splitter,Splitter>> for more information.

The Control Bus can now handle `Pausable` (extension of `Lifecycle`) operations.
See <<./control-bus.adoc#control-bus,Control Bus>> for more information.

The `Function<MessageGroup, Map<String, Object>>` strategy has been introduced for the aggregator component to merge and compute headers for output messages.
See <<./aggregator.adoc#aggregator-api,Aggregator Programming Model>> for more information.

All the `MessageHandlingException` s thrown in the framework, includes now a bean resource and source for back tracking a configuration part in case no end-user code involved.
See <<./error-handling.adoc#error-handling,Error Handling>> for more information.

For better end-user experience, Java DSL now provides a configurer variant for starting flow with a gateway interface.
See `IntegrationFlows.from(Class<?> serviceInterface, Consumer<GatewayProxySpec> endpointConfigurer)` JavaDocs for more information.
Also a `MethodArgsHolder` is now a root object for evaluation context for all the expressions in the `GatewayProxyFactoryBean`.
The `#args` and `#method` evaluation context variables are now deprecated.
See <<./gateway.adoc#gateway,Messaging Gateways>> for more information.

[[x5.2-amqp]]
==== AMQP Changes

The outbound endpoints can now be configured to synthesize a "nack" if no publisher confirm is received within a timeout.
See <<./amqp.adoc#amqp-outbound-endpoints,Outbound Channel Adapter>> for more information.

The inbound channel adapter can now receive batched messages as a `List<?>` payload instead of receiving a discrete message for each batch fragment.
See <<./amqp.adoc#amqp-debatching,Batched Messages>> for more information.

The outbound channel adapter can now be configured to block the calling thread until a publisher confirm (acknowledgment) is received.
See <<./amqp.adoc#amqp-outbound-channel-adapter,Outbound Channel Adapter>> for more information.

[[x5.2-file]]
==== File Changes

Some improvements to filtering remote files have been made.
See <<./file.adoc#remote-persistent-flf,Remote Persistent File List Filters>> for more information.

[[x5.2-tcp]]
==== TCP Changes

The length header used by the `ByteArrayLengthHeaderSerializer` can now include the length of the header in addition to the payload.
See <<./ip.adoc#tcp-codecs,Message Demarcation (Serializers and Deserializers)>> for more information.

When using a `TcpNioServerConnectionFactory`, priority is now given to accepting new connections over reading from existing connections, but it is configurable.
See <<./ip.adoc#note-nio,About Non-blocking I/O (NIO)>> for more information.

The outbound gateway has a new property `closeStreamAfterSend`; when used with a new connection for each request/reply it signals EOF to the server, without closing the connection.
This is useful for servers that use the EOF to signal end of message instead of some delimiter in the data.
See <<./ip.adoc#tcp-gateways, TCP Gateways>> for more information.

The client connection factories now support `connectTimeout` which causes an exception to be thrown if the connection is not established in that time.
See <<./ip.adoc#tcp-connection-factory, TCP Connection Factories>> for more information.

`SoftEndOfStreamException` is now a `RuntimeException` instead of extending `IOException`.

[[x5.2-mail]]
==== Mail Changes

The `AbstractMailReceiver` has now an `autoCloseFolder` option (`true` by default), to disable an automatic folder close after a fetch, but populate `IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE` header instead for downstream interaction.
See <<./mail.adoc#mail-inbound,Mail-receiving Channel Adapter>> for more information.

[[x5.2-http]]
==== HTTP Changes

The HTTP inbound endpoint now support a request payload validation.
See <<./http.adoc#http,HTTP Support>> for more information.

[[x5.2-webflux]]
==== WebFlux Changes

The `WebFluxRequestExecutingMessageHandler` now supports a `Publisher`, `Resource` and `MultiValueMap` as a request message `payload`.
The `WebFluxInboundEndpoint` now supports a request payload validation.
See <<./webflux.adoc#webflux,WebFlux Support>> for more information.

[[x5.2-mongodb]]
==== MongoDb Changes

The `MongoDbMessageStore` can now be configured with custom converters.
See <<./mongodb.adoc#mongodb, MongoDB Support>> for more information.

[[x5.2-routers]]
==== Router Changes

You can now disable falling back to the channel key as the channel bean name.
See <<./router.adoc#dynamic-routers, Dynamic Routers>> for more information.

[[x5.2--ftp-sftp]]
==== FTP/SFTP Changes

The `RotatingServerAdvice` is decoupled now from the `RotationPolicy` and its `StandardRotationPolicy`.

The remote file information, including host/port and directory are included now into message headers in the `AbstractInboundFileSynchronizingMessageSource` and `AbstractRemoteFileStreamingMessageSource` implementations.
Also this information is included into headers in the read operations results of the `AbstractRemoteFileOutboundGateway` implementations.
The FTP outbound endpoints now support `chmod` to change permissions on the uploaded file.
(SFTP already supported it since version 4.3).
See <<./ftp.adoc#ftp, FTP(S) Support>> and <<./sftp.adoc#sftp, SFTP Support>> for more information.
