Changes between 4.2 and 4.3
有关可能影响您应用程序的重要改动,请参见 Migration Guide。您可以在 Wiki 上找到针对 2.1 及更高版本的所有迁移指南。
See the Migration Guide for important changes that might affect your applications. You can find migration guides for all versions back to 2.1 on the Wiki.
New Components
4.3 版新增了许多新组件。
Version 4.3 added a number of new components.
MessageGroupFactory
我们引入了 `MessageGroupFactory`策略来允许在 `MessageGroupStore`逻辑中控制 `MessageGroup`实例。我们为 `SimpleMessageGroup`添加了 `SimpleMessageGroupFactory`实现,`GroupType.HASH_SET`是标准 `MessageGroupStore`实现的默认工厂。有关详细信息,请参阅 Message Store。
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 for more information.
PersistentMessageGroup
我们为持久性 MessageGroupStore`实例添加了 `PersistentMessageGroup
(延迟加载代理)实现,当其 lazyLoadMessageGroups`为 `true
(默认值)时,在 `getMessageGroup()`时为其返回此实例。有关详细信息,请参阅 Message Store。
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 for more information.
FTP and SFTP Streaming Inbound Channel Adapters
我们添加返回每个文件的 `InputStream`的入站通道适配器,使你无需将其写入本地文件系统即可检索远程文件。有关详细信息,请参阅 FTP Streaming Inbound Channel Adapter和 SFTP Streaming Inbound Channel Adapter。
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 Streaming Inbound Channel Adapter and SFTP Streaming Inbound Channel Adapter for more information.
StreamTransformer
我们添加 StreamTransformer
以将 InputStream
有效负载转换为 byte[]
或 String
。有关详细信息,请参见 Stream Transformer。
We added StreamTransformer
to transform an InputStream
payload to either a byte[]
or a String
.
See Stream Transformer for more information.
Integration Graph
我们添加 IntegrationGraphServer
与 IntegrationGraphController
REST 服务一起,以将 Spring Integration 应用程序的运行时模型公开为图形。有关详细信息,请参见 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 Integration Graph for more information.
JDBC Lock Registry
我们添加 JdbcLockRegistry
用于通过数据库表共享的分布式锁。有关详细信息,请参见 JDBC Lock Registry。
We added JdbcLockRegistry
for distributed locks shared through a database table.
See JDBC Lock Registry for more information.
LeaderInitiator
for LockRegistry
我们添加基于 LockRegistry
策略的 LeaderInitiator
实现。有关详细信息,请参见 Leadership Event Handling。
We added LeaderInitiator
implementation based on the LockRegistry
strategy.
See Leadership Event Handling for more information.
General Changes
本节介绍 4.3 版为 Spring Integration 带来的总体变更。
This section describes general changes that version 4.3 brought to Spring Integration.
Core Changes
本节介绍 Spring Integration 核心的一般变更。
This section describes general changes to the core of Spring Integration.
Outbound Gateway within a Chain
先前,你可以在链中的出站网关上指定一个 reply-channel
。它被完全忽略。网关的回复会发送到下一个链元素,或者如果网关是最后一个元素,则发送到链的输出通道。此条件现在已检测到并禁止。如果你有这样的配置,请移除 reply-channel
。
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
我们添加一个选项,使服务激活成为同步的。有关详细信息,请参见 Asynchronous Service Activator。
We added an option to make the service activator be synchronous. See Asynchronous Service Activator for more information.
Messaging Annotation Support changes
消息注释支持不需要在类级别上声明 @MessageEndpoint
(或任何其他 @Component
)注释。要恢复以前的行为,将 spring.integration.properties
的 spring.integration.messagingAnnotations.require.componentAnnotation
设置为 true
。有关更多信息,请参见 Global Properties 和 Annotation Support。
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 Global Properties and Annotation Support for more information.
Mail Changes
本节介绍 Spring Integration Mail 功能的常规更改。
This section describes general changes to the Spring Integration Mail functionality.
Customizable User Flag
可自定义的 userFlag
(在 4.2.2 中添加,用于自定义标记以表示已看到邮件)现可在 XML 命名空间中获得。有关详细信息,请参见 Marking IMAP Messages When Recent
Is Not Supported。
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 Marking IMAP Messages When Recent
Is Not Supported for more information.
Mail Message Mapping
您现在可以使用包含邮件标头和包含电子邮件内容的有效负载的 MessageHeaders
映射入站邮件消息。以前,有效负载始终是原始 MimeMessage
。有关详细信息,请参见 Inbound 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 Inbound Mail Message Mapping for more information.
JMS Changes
本节介绍 Spring Integration JMS 功能的常规更改。
This section describes general changes to the Spring Integration JMS functionality.
Header Mapper
DefaultJmsHeaderMapper
现通过调用其 toString()
方法将标准 correlationId
标头映射为消息属性。有关详细信息,请参见 Mapping Message Headers to and from JMS Message。
The DefaultJmsHeaderMapper
now maps the standard correlationId
header as a message property by invoking its toString()
method.
See Mapping Message Headers to and from JMS Message for more information.
Asynchronous Gateway
JMS 出站网关现有一个 async
属性。有关详细信息,请参见 Async Gateway。
The JMS outbound gateway now has an async
property.
See Async Gateway for more information.
Aggregator Changes
POJO 聚合器释放 Message<?>
对象的集合时,行为发生了变化。这种情况很少发生,但如果您的应用程序执行此操作,则需要对您的 POJO 进行小改动。有关详细信息,请参见此 IMPORTANT: The SimpleMessageGroup.getMessages()
method returns an unmodifiableCollection
. 备注。
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 IMPORTANT: The SimpleMessageGroup.getMessages()
method returns an unmodifiableCollection
. note for more information.
[[tcp/udp-changes]]=== TCP/UDP 更改
[[tcp/udp-changes]] === TCP/UDP Changes
本节介绍 Spring Integration TCP/UDP 功能的常规更改。
This section describes general changes to the Spring Integration TCP/UDP functionality.
Events
启动服务器连接工厂时会发出一个新的 TcpConnectionServerListeningEvent
。有关详细信息,请参见 TCP Connection Events。
A new TcpConnectionServerListeningEvent
is emitted when a server connection factory is started.
See TCP Connection Events for more information.
您现在可以在 <int-ip:udp-outbound-channel-adapter>
上使用 destination-expression
和 socket-expression
属性。有关更多信息,请参见 UDP Adapters。
You can now use the destination-expression
and socket-expression
attributes on <int-ip:udp-outbound-channel-adapter>
.
See UDP Adapters for more information.
Stream Deserializers
直到组装整个消息后才能分配最终缓冲区的各种反序列化器现在支持将接收数据的原始缓冲区放入池中,而不是为每条消息创建并丢弃一个缓冲区。有关更多信息,请参见 TCP Connection Factories。
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 TCP Connection Factories for more information.
TCP Message Mapper
消息映射器现在会根据选择设置一个已配置的内容类型标头。有关更多信息,请参见 IP Message Headers。
The message mapper now, optionally, sets a configured content type header. See IP Message Headers for more information.
File Changes
本节介绍 Spring Integration 文件功能的常规更改。
This section describes general changes to the Spring Integration File functionality.
Destination Directory Creation
FileWritingMessageHandler
的生成文件名可以表示子路径,以便在目标目录中保存文件所需的目录结构。有关详细信息,请参见 Generating File Names。
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 Generating File Names for more information.
FileReadingMessageSource
现在将 WatchService
目录扫描逻辑隐藏在内部类中。我们增加了 use-watch-service
和 watch-events
选项来启用此行为。我们弃用了顶级 WatchServiceDirectoryScanner
,因为它与 API 不一致。有关详细信息,请参阅 WatchServiceDirectoryScanner
。
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 WatchServiceDirectoryScanner
for more information.
Appending and Flushing
你现在可以避免在追加时刷新文件,并使用多种策略在闲置期间刷新数据。有关详细信息,请参阅 Flushing Files When Using APPEND_NO_FLUSH
。
You can now avoid flushing files when appending and use a number of strategies to flush the data during idle periods.
See Flushing Files When Using APPEND_NO_FLUSH
for more information.
Preserving Timestamps
你现在可以配置出站通道适配器以设置目标文件的 lastmodified
时间戳。有关详细信息,请参阅 File Timestamps。
You can now configure the outbound channel adapter to set the destination file’s lastmodified
timestamp.
See File Timestamps for more information.
Splitter Changes
当文件完全读取时,FileSplitter
现在会自动关闭 FTP 或 SFTP 会话。当出站网关返回 InputStream
或使用新的 FTP 或 SFTP 流式信道适配器时,此规则适用。我们还引入了新的 markers-json
选项,以将 FileSplitter.FileMarker
转换为 JSON String
,以缓解下游网络交互。有关更多信息,请参见 File Splitter。
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 Splitter for more information.
File Filters
我们添加了 ChainFileListFilter
作为 CompositeFileListFilter
的替代。有关更多信息,请参见 Reading Files。
We added ChainFileListFilter
as an alternative to CompositeFileListFilter
.
See Reading Files for more information.
AMQP Changes
本节介绍了 Spring Integration AMQP 功能的一些一般性更改。
This section describes general changes to the Spring Integration AMQP functionality.
Content Type Message Converter
出站端点现在支持使用 RabbitTemplate
配置的 ContentTypeDelegatingMessageConverter
,以便您可以根据消息内容类型选择转换器。有关更多信息,参见 Outbound Message Conversion。
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 Outbound Message Conversion for more information.
Headers for Delayed Message Handling
Spring AMQP 1.6 添加了对 delayed message exchanges 的支持。标头映射现在支持此功能使用的标头 (amqp_delay
和 amqp_receivedDelay
)。
Spring AMQP 1.6 adds support for delayed message exchanges.
Header mapping now supports the headers (amqp_delay
and amqp_receivedDelay
) used by this feature.
AMQP-Backed Channels
AMQP 支持的通道现在支持消息映射。有关更多信息,参见 AMQP-backed Message Channels。
AMQP-backed channels now support message mapping. See AMQP-backed Message Channels for more information.
Redis Changes
本节介绍对 Spring 集成 Redis 功能做出的常规更改。
This section describes general changes to the Spring Integration Redis functionality.
[[list-push/pop-direction]]==== 列表入/出方向
[[list-push/pop-direction]] ==== List Push/Pop Direction
以前,队列通道适配器总是固定使用 Redis 列表,将其推入左侧并从右侧读取。你现在可以使用 RedisQueueMessageDrivenEndpoint
和 RedisQueueOutboundChannelAdapter
的 rightPop
和 leftPush
选项分别配置读取和写入方向。有关详细信息,请参阅 Redis Queue Inbound Channel Adapter 和 Redis Queue Outbound Channel Adapter。
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 Queue Inbound Channel Adapter and Redis Queue Outbound Channel Adapter for more information.
Queue Inbound Gateway Default Serializer
入站网关中的默认序列化程序已更改为 JdkSerializationRedisSerializer
,以与出站网关兼容。有关详细信息,请参阅 Redis Queue Inbound Gateway。
The default serializer in the inbound gateway has been changed to a JdkSerializationRedisSerializer
for compatibility with the outbound gateway.
See Redis Queue Inbound Gateway for more information.
HTTP Changes
以前,对于具有正文的请求(例如 POST
)没有 content-type
标头的请求将被忽略。通过此发行,此类请求的内容类型被视为 application/octet-stream
,如 RFC 2616 所建议的。有关更多信息,参见 Http Inbound Components。
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 Inbound Components for more information.
uriVariablesExpression
现在在默认情况下使用 SimpleEvaluationContext
(自 4.3.15 起)。有关详细信息,请参阅 Mapping URI Variables。
uriVariablesExpression
now uses a SimpleEvaluationContext
by default (since 4.3.15).
See Mapping URI Variables for more information.
SFTP Changes
本节介绍对 Spring 集成 SFTP 功能做出的常规更改。
This section describes general changes to the Spring Integration SFTP functionality.
Factory Bean
我们添加了一个新的工厂 Bean,以简化 SFTP 的 Jsch 代理的配置。更多信息,请参阅 JschProxyFactoryBean
。
We added a new factory bean to simplify the configuration of Jsch proxies for SFTP.
See JschProxyFactoryBean
for more information.
chmod
Changes
SFTP 出站网关(用于 put
和 mput
命令)和 SFTP 出站通道适配器现在支持 chmod
属性,以便在上传后更改远程文件权限。有关更多信息,参见 SFTP Outbound Channel Adapter
和 SFTP Outbound Gateway
。
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 Outbound Channel Adapter
and SFTP Outbound Gateway
for more information.
FTP Changes
本节介绍对 Spring 集成 FTP 功能做出的常规更改。
This section describes general changes to the Spring Integration FTP functionality.
Session Changes
FtpSession
现在支持 null
以用于 list()
和 listNames()
方法,因为底层 FTP 客户端可以使用它。有了它,您现在可以无需 remoteDirectory
表达式即可配置 FtpOutboundGateway
。您还可以无需 remote-directory
或 remote-directory-expression
配置 <int-ftp:inbound-channel-adapter>
。有关更多信息,参见 FTP/FTPS Adapters。
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/FTPS Adapters for more information.
Router Changes
ErrorMessageExceptionTypeRouter
现在支持 Exception
超类映射,以避免在多个继承者的情况下为同一路由进行重复。为了这个目的,ErrorMessageExceptionTypeRouter
在初始化期间加载映射类,以针对 ClassNotFoundException
快速失败。
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
.
有关更多信息,参见 Routers。
See Routers for more information.
Header Mapping
这一部分描述了从 4.2 版到 4.3 版的头映射所做的更改。
This section describes the changes to header mapping between version 4.2 and 4.3.
General
AMQP、WS 和 XMPP 标头映射(例如 request-header-mapping
和 reply-header-mapping
)现在支持否定模式。有关详细信息,请参阅 AMQP Message Headers、 WS Message Headers 和 XMPP Message Headers。
AMQP, WS, and XMPP header mappings (such as request-header-mapping
and reply-header-mapping
) now support negated patterns.
See AMQP Message Headers, WS Message Headers, and XMPP Message Headers for more information.
AMQP Header Mapping
以前,默认情况下只映射标准 AMQP 标头。您必须显式启用用户定义标头的映射。通过此发行,默认情况下所有标头都被映射。此外,入站 amqp_deliveryMode
标头不再默认映射。有关更多信息,参见 AMQP Message Headers。
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 Message Headers for more information.
Groovy Scripts
你现在可以使用 compile-static
提示或任何其他 CompilerConfiguration
选项配置 groovy 脚本。有关详细信息,请参阅 Groovy Configuration。
You can now configure groovy scripts with the compile-static
hint or any other CompilerConfiguration
options.
See Groovy Configuration for more information.
@InboundChannelAdapter
Changes
@InboundChannelAdapter
现在有一个别名 channel
属性,用于常规 value
。此外,目标 SourcePollingChannelAdapter
组件现在可以按延迟绑定方式从其提供的名称(outputChannelName
选项)中解析目标 outputChannel
Bean。有关更多信息,参见 Annotation Support。
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 Annotation Support for more information.
XMPP Changes
XMPP 通道适配器现在支持 XMPP 扩展 (XEP)。有关详细信息,请参阅 XMPP Extensions。
The XMPP channel adapters now support the XMPP Extensions (XEP). See XMPP Extensions for more information.
WireTap Late Binding
WireTap
ChannelInterceptor
现在可以接受一个 channelName
,它将在第一个活动拦截器操作期间解析为目标 MessageChannel
。有关详细信息,请参阅 Wire Tap。
The WireTap
ChannelInterceptor
now can accept a channelName
that is resolved to the target MessageChannel
later, during the first active interceptor operation.
See Wire Tap for more information.
ChannelMessageStoreQueryProvider
Changes
ChannelMessageStoreQueryProvider
现在支持 H2 数据库。有关详细信息,请参阅 Backing Message Channels。
The ChannelMessageStoreQueryProvider
now supports H2 databases.
See Backing Message Channels for more information.
WebSocket Changes
ServerWebSocketContainer
现在公开了 allowedOrigins
选项,而 SockJsServiceOptions
公开了 suppressCors
选项。有关更多信息,参见 WebSockets Support。
The ServerWebSocketContainer
now exposes an allowedOrigins
option, and SockJsServiceOptions
exposes a suppressCors
option.
See WebSockets Support for more information.