Files
spring-integration/src/reference/asciidoc/changes-4.2-4.3.adoc
Artem Bilan 4aa2f91bd9 GH-3572: Migrate SFTP from jsch to sshd-sftp (#3892)
* GH-3572: Migrate SFTP from `jsch` to `sshd-sftp`

Fixes https://github.com/spring-projects/spring-integration/issues/3572

* Rework SFTP module from the JSch API to more modern `sshd-sftp`
* Migrate generics of most API from `ChannelSftp.LsEntry` to the `SftpClient.DirEntry`
* Rework `DefaultSftpSessionFactory` to deal with an `SshClient` and create `SftpClient`
wrapped to the `SftpSession`
* Implement a `ResourceKnownHostsServerKeyVerifier` to load `known-hosts` from any possible resource
* Implement an expected `SftpSession.list()` with just file name to take or pattern matching
* Remove some unused tests and their config
* Remove tests for custom `UserInfo` since we don't provide any custom out-of-the-box
* Test a new `ResourceKnownHostsServerKeyVerifier` against default `known-hosts` file

* * Some tests improvements

* * Improve generics handling for `FileUtils`
2022-09-27 13:10:11 -04:00

308 lines
14 KiB
Plaintext

[[migration-4.2-4.3]]
=== Changes between 4.2 and 4.3
See the https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-4.2-to-4.3-Migration-Guide[Migration Guide]
for important changes that might affect your applications.
You can find migration guides for all versions back to 2.1 on the https://github.com/spring-projects/spring-integration/wiki[Wiki].
[[x4.3-new-components]]
==== New Components
Version 4.3 added a number of new components.
===== AMQP Async Outbound Gateway
See <<./amqp.adoc#amqp-async-outbound-gateway,Asynchronous Outbound Gateway>>.
===== `MessageGroupFactory`
We introduced the `MessageGroupFactory` strategy to allow control over `MessageGroup` instances in `MessageGroupStore` logic.
We added `SimpleMessageGroupFactory` implementation for the `SimpleMessageGroup`, with the `GroupType.HASH_SET` as the default
factory for the standard `MessageGroupStore` implementations.
See <<./message-store.adoc#message-store,Message Store>> for more information.
===== `PersistentMessageGroup`
We added the `PersistentMessageGroup` (lazy-load proxy) implementation for persistent `MessageGroupStore` instances,
which return this instance for the `getMessageGroup()` when their `lazyLoadMessageGroups` is `true` (the default).
See <<./message-store.adoc#message-store,Message Store>> for more information.
===== FTP and SFTP Streaming Inbound Channel Adapters
We added inbound channel adapters that return an `InputStream` for each file, letting you retrieve remote files without writing them to the local file system.
See <<./ftp.adoc#ftp-streaming,FTP Streaming Inbound Channel Adapter>> and <<./sftp.adoc#sftp-streaming,SFTP Streaming Inbound Channel Adapter>> for more information.
===== `StreamTransformer`
We added `StreamTransformer` to transform an `InputStream` payload to either a `byte[]` or a `String`.
See <<./transformer.adoc#stream-transformer,Stream Transformer>> for more information.
===== Integration Graph
We added `IntegrationGraphServer`, together with the `IntegrationGraphController` REST service, to expose the runtime model of a Spring Integration application as a graph.
See <<./graph.adoc#integration-graph,Integration Graph>> for more information.
===== JDBC Lock Registry
We added `JdbcLockRegistry` for distributed locks shared through a database table.
See <<./jdbc.adoc#jdbc-lock-registry,JDBC Lock Registry>> for more information.
===== `LeaderInitiator` for `LockRegistry`
We added `LeaderInitiator` implementation based on the `LockRegistry` strategy.
See <<./endpoint.adoc#leadership-event-handling,Leadership Event Handling>> for more information.
[[x4.3-general]]
==== General Changes
This section describes general changes that version 4.3 brought to Spring Integration.
===== Core Changes
This section describes general changes to the core of Spring Integration.
====== Outbound Gateway within a Chain
Previously, you could specify a `reply-channel` on an outbound gateway within a chain.
It was completely ignored.
The gateway's reply goes to the next chain element or, if the gateway is the last element, to the chain's output channel.
This condition is now detected and disallowed.
If you have such a configuration, remove the `reply-channel`.
====== Asynchronous Service Activator
We added an option to make the service activator be synchronous.
See <<./service-activator.adoc#async-service-activator,Asynchronous Service Activator>> for more information.
====== Messaging Annotation Support changes
The messaging annotation support does not require a `@MessageEndpoint` (or any other `@Component`) annotation declaration on the class level.
To restore the previous behavior, set the `spring.integration.messagingAnnotations.require.componentAnnotation` of
`spring.integration.properties` to `true`.
See <<./configuration.adoc#global-properties,Global Properties>> and <<./configuration.adoc#annotations,Annotation Support>> for more information.
===== Mail Changes
This section describes general changes to the Spring Integration Mail functionality.
====== Customizable User Flag
The customizable `userFlag` (added in 4.2.2 to provide customization of the flag used to denote that the mail has been
seen) is now available in the XML namespace.
See <<./mail.adoc#imap-seen,Marking IMAP Messages When `\Recent` Is Not Supported>> for more information.
====== Mail Message Mapping
You can now map inbound mail messages with the `MessageHeaders` containing the mail headers and the payload containing the email content.
Previously, the payload was always the raw `MimeMessage`.
See <<./mail.adoc#mail-mapping,Inbound Mail Message Mapping>> for more information.
===== JMS Changes
This section describes general changes to the Spring Integration JMS functionality.
====== Header Mapper
The `DefaultJmsHeaderMapper` now maps the standard `correlationId` header as a message property by invoking its `toString()` method.
See <<./jms.adoc#jms-header-mapping,Mapping Message Headers to and from JMS Message>> for more information.
====== Asynchronous Gateway
The JMS outbound gateway now has an `async` property.
See <<./jms.adoc#jms-async-gateway,Async Gateway>> for more information.
===== Aggregator Changes
There is a change in behavior when a POJO aggregator releases a collection of `Message<?>` objects.
This is rare, but, if your application does that, you need to make a small change to your POJO.
See this <<./aggregator.adoc#agg-message-collection,IMPORTANT: The `SimpleMessageGroup.getMessages()` method returns an `unmodifiableCollection`.>> note for more information.
===== TCP/UDP Changes
This section describes general changes to the Spring Integration TCP/UDP functionality.
====== Events
A new `TcpConnectionServerListeningEvent` is emitted when a server connection factory is started.
See <<./ip.adoc#tcp-events,TCP Connection Events>> for more information.
You can now use the `destination-expression` and `socket-expression` attributes on `<int-ip:udp-outbound-channel-adapter>`.
See <<./ip.adoc#udp-adapters,UDP Adapters>> for more information.
====== Stream Deserializers
The various deserializers that cannot allocate the final buffer until the whole message has been assembled now support pooling the raw buffer into which the data is received rather than creating and discarding a buffer for each message.
See <<./ip.adoc#tcp-connection-factories,TCP Connection Factories>> for more information.
====== TCP Message Mapper
The message mapper now, optionally, sets a configured content type header.
See <<./ip.adoc#ip-msg-headers,IP Message Headers>> for more information.
===== File Changes
This section describes general changes to the Spring Integration File functionality.
====== Destination Directory Creation
The generated file name for the `FileWritingMessageHandler` can represent a sub-path to save the desired directory structure for a file in the target directory.
See <<./file.adoc#file-writing-file-names,Generating File Names>> for more information.
The `FileReadingMessageSource` now hides the `WatchService` directory scanning logic in the inner class.
We added the `use-watch-service` and `watch-events` options to enable this behavior.
We deprecated the top-level `WatchServiceDirectoryScanner` because of inconsistency around the API.
See <<./file.adoc#watch-service-directory-scanner,`WatchServiceDirectoryScanner`>> for more information.
====== Buffer Size
When writing files, you can now specify the buffer size.
====== Appending and Flushing
You can now avoid flushing files when appending and use a number of strategies to flush the data during idle periods.
See <<./file.adoc#file-flushing,Flushing Files When Using `APPEND_NO_FLUSH`>> for more information.
====== Preserving Timestamps
You can now configure the outbound channel adapter to set the destination file's `lastmodified` timestamp.
See <<./file.adoc#file-timestamps,File Timestamps>> for more information.
====== Splitter Changes
The `FileSplitter` now automatically closes an FTP or SFTP session when the file is completely read.
This applies when the outbound gateway returns an `InputStream` or when you use the new FTP or SFTP streaming channel adapters.
We also introduced a new `markers-json` option to convert `FileSplitter.FileMarker` to JSON `String` for relaxed downstream network interaction.
See <<./file.adoc#file-splitter,File Splitter>> for more information.
====== File Filters
We added `ChainFileListFilter` as an alternative to `CompositeFileListFilter`.
See <<./file.adoc#file-reading,Reading Files>> for more information.
===== AMQP Changes
This section describes general changes to the Spring Integration AMQP functionality.
====== Content Type Message Converter
The outbound endpoints now support a `RabbitTemplate` configured with a `ContentTypeDelegatingMessageConverter` such
that you can choose the converter based on the message content type.
See <<./amqp.adoc#content-type-conversion-outbound,Outbound Message Conversion>> for more information.
====== Headers for Delayed Message Handling
Spring AMQP 1.6 adds support for https://www.rabbitmq.com/blog/2015/04/16/scheduling-messages-with-rabbitmq/[delayed message exchanges].
Header mapping now supports the headers (`amqp_delay` and `amqp_receivedDelay`) used by this feature.
====== AMQP-Backed Channels
AMQP-backed channels now support message mapping.
See <<./amqp.adoc#amqp-channels,AMQP-backed Message Channels>> for more information.
===== Redis Changes
This section describes general changes to the Spring Integration Redis functionality.
====== List Push/Pop Direction
Previously, the queue channel adapters always used the Redis list in a fixed direction, pushing to the left end and reading from the right end.
You can now configure the reading and writing direction with the `rightPop` and `leftPush` options for the
`RedisQueueMessageDrivenEndpoint` and `RedisQueueOutboundChannelAdapter`, respectively.
See <<./redis.adoc#redis-queue-inbound-channel-adapter,Redis Queue Inbound Channel Adapter>> and <<./redis.adoc#redis-queue-outbound-channel-adapter,Redis Queue Outbound Channel Adapter>> for more information.
====== Queue Inbound Gateway Default Serializer
The default serializer in the inbound gateway has been changed to a `JdkSerializationRedisSerializer` for compatibility with the outbound gateway.
See <<./redis.adoc#redis-queue-inbound-gateway,Redis Queue Inbound Gateway>> for more information.
===== HTTP Changes
Previously, with requests that had a body (such as `POST`) that had no `content-type` header, the body was ignored.
With this release, the content type of such requests is considered to be `application/octet-stream` as recommended
by RFC 2616.
See <<./http.adoc#http-inbound,Http Inbound Components>> for more information.
`uriVariablesExpression` now uses a `SimpleEvaluationContext` by default (since 4.3.15).
See <<./http.adoc#mapping-uri-variables,Mapping URI Variables>> for more information.
===== SFTP Changes
This section describes general changes to the Spring Integration SFTP functionality.
====== Factory Bean
We added a new factory bean to simplify the configuration of Jsch proxies for SFTP.
See `JschProxyFactoryBean` for more information.
====== `chmod` Changes
The SFTP outbound gateway (for `put` and `mput` commands) and the SFTP outbound channel adapter now support the `chmod` attribute to change the remote file permissions after uploading.
See `<<./sftp.adoc#sftp-outbound,SFTP Outbound Channel Adapter>>` and `<<./sftp.adoc#sftp-outbound-gateway,SFTP Outbound Gateway>>` for more information.
===== FTP Changes
This section describes general changes to the Spring Integration FTP functionality.
====== Session Changes
The `FtpSession` now supports `null` for the `list()` and `listNames()` methods, since underlying FTP Client can use it.
With that, you can now configure the `FtpOutboundGateway` without the `remoteDirectory` expression.
You can also configure the `<int-ftp:inbound-channel-adapter>` without `remote-directory` or `remote-directory-expression`.
See <<./ftp.adoc#ftp,FTP/FTPS Adapters>> for more information.
===== Router Changes
The `ErrorMessageExceptionTypeRouter` now supports the `Exception` superclass mappings to avoid duplication for the same channel in case of multiple inheritors.
For this purpose, the `ErrorMessageExceptionTypeRouter` loads mapping classes during initialization to fail-fast for a `ClassNotFoundException`.
See <<./router.adoc#router,Routers>> for more information.
===== Header Mapping
This section describes the changes to header mapping between version 4.2 and 4.3.
====== General
AMQP, WS, and XMPP header mappings (such as `request-header-mapping` and `reply-header-mapping`) now support negated patterns.
See <<./amqp.adoc#amqp-message-headers,AMQP Message Headers>>, <<./ws.adoc#ws-message-headers,WS Message Headers>>, and <<./xmpp.adoc#xmpp-message-headers,XMPP Message Headers>> for more information.
====== AMQP Header Mapping
Previously, only standard AMQP headers were mapped by default.
You had to explicitly enable mapping of user-defined headers.
With this release, all headers are mapped by default.
In addition, the inbound `amqp_deliveryMode` header is no longer mapped by default.
See <<./amqp.adoc#amqp-message-headers,AMQP Message Headers>> for more information.
===== Groovy Scripts
You can now configure groovy scripts with the `compile-static` hint or any other `CompilerConfiguration` options.
See <<./groovy.adoc#groovy-config,Groovy Configuration>> for more information.
===== `@InboundChannelAdapter` Changes
The `@InboundChannelAdapter` now has an alias `channel` attribute for the regular `value`.
In addition, the target `SourcePollingChannelAdapter` components can now resolve the target `outputChannel` bean from its provided name (`outputChannelName` options) in a late-binding manner.
See <<./configuration.adoc#annotations,Annotation Support>> for more information.
===== XMPP Changes
The XMPP channel adapters now support the XMPP Extensions (XEP).
See <<./xmpp.adoc#xmpp-extensions,XMPP Extensions>> for more information.
===== WireTap Late Binding
The `WireTap` `ChannelInterceptor` now can accept a `channelName` that is resolved to the target `MessageChannel`
later, during the first active interceptor operation.
See <<./channel.adoc#channel-wiretap,Wire Tap>> for more information.
===== `ChannelMessageStoreQueryProvider` Changes
The `ChannelMessageStoreQueryProvider` now supports H2 databases.
See <<./jdbc.adoc#jdbc-message-store-channels,Backing Message Channels>> for more information.
===== WebSocket Changes
The `ServerWebSocketContainer` now exposes an `allowedOrigins` option, and `SockJsServiceOptions` exposes a `suppressCors` option.
See <<./web-sockets.adoc#web-sockets,WebSockets Support>> for more information.