Changes between 4.0 and 4.1
参见 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.1 添加了许多新组件。
Version 4.1 added a number of new components.
Promise<?> Gateway
消息网关方法现在支持 Reactor `Promise`返回类型。请参阅 Asynchronous Gateway。
The messaging gateway methods now support a Reactor Promise
return type.
See Asynchronous Gateway.
WebSocket support
WebSocket`模块现已推出。它完全基于 Spring WebSocket 和 Spring Messaging 模块,并提供 `<inbound-channel-adapter>`和 `<outbound-channel-adapter>
。有关详细信息,请参阅 WebSockets Support。
The WebSocket
module is now available.
It is fully based on the Spring WebSocket and Spring Messaging modules and provides an <inbound-channel-adapter>
and an <outbound-channel-adapter>
.
See WebSockets Support for more information.
Scatter-Gather Enterprise Integration Pattern
我们实施了分散收集企业集成模式。有关详细信息,请参阅 Scatter-Gather。
We implemented the scatter-gather enterprise integration pattern. See Scatter-Gather for more information.
Routing Slip Pattern
我们添加了路由单据 EIP 模式实现。有关详细信息,请参见 Routing Slip。
We added the routing slip EIP pattern implementation. See Routing Slip for more information.
Idempotent Receiver Pattern
通过在 XML 中添加 `<idempotent-receiver>`组件或为 Java 配置添加 `IdempotentReceiverInterceptor`和 `IdempotentReceiver`注释,我们添加了幂等接收方企业集成模式实现。有关详细信息,请参见 Idempotent Receiver Enterprise Integration Pattern和 Javadoc。
We added the idempotent receiver enterprise integration pattern implementation by adding the <idempotent-receiver>
component in XML or the IdempotentReceiverInterceptor
and IdempotentReceiver
annotations for Java configuration.
See Idempotent Receiver Enterprise Integration Pattern and the Javadoc for more information.
Boon JsonObjectMapper
我们为 JSON 转换器添加了 Boon JsonObjectMapper
。有关详细信息,请参见 Transformer。
We added the Boon JsonObjectMapper
for the JSON transformers.
See Transformer for more information.
Redis Queue Gateways
我们添加了 `<redis-queue-inbound-gateway>`和 `<redis-queue-outbound-gateway>`组件。请参阅 Redis Queue Inbound Gateway和 Redis Queue Outbound Gateway。
We added the <redis-queue-inbound-gateway>
and <redis-queue-outbound-gateway>
components.
See Redis Queue Inbound Gateway and Redis Queue Outbound Gateway.
PollSkipAdvice
我们增加了 PollSkipAdvice
,您可以在 `<advice-chain>`的 `<poller>`内使用它来确定当前的轮询是否应通过使用 `PollSkipStrategy`实现的某些条件来抑制(跳过)。有关更多信息,请参阅 Poller。
We added the PollSkipAdvice
, which you can use within the <advice-chain>
of the <poller>
to determine if the current poll should be suppressed (skipped) by some condition that you implement with PollSkipStrategy
.
See Poller for more information.
General Changes
本节描述了从 4.0 版到 4.1 版的一般性更改。
This section describes general changes from version 4.0 to version 4.1.
AMQP Inbound Endpoints, Channel
现在使用消息侦听器容器(入站端点和通道)的元素支持 `missing-queues-fatal`属性。有关更多信息,请参见 AMQP Support。
Elements that use a message listener container (inbound endpoints and channel) now support the missing-queues-fatal
attribute.
See AMQP Support for more information.
AMQP Outbound Endpoints
AMQP 出站端点支持一个名为 lazy-connect
(默认: true
)的新属性。当 `true`时,与代理的连接在第一个消息到达之前不会建立(假设没有入站端点,它们始终会在启动期间尝试建立连接)。当设定 `false`时,会在应用程序启动期间尝试建立连接。请参阅 AMQP Support了解更多信息。
The AMQP outbound endpoints support a new property called lazy-connect
(default: true
).
When true
, the connection to the broker is not established until the first message arrives (assuming there are no inbound endpoints, which always try to establish the connection during startup).
When set to false
, an attempt to establish the connection is made during application startup.
See AMQP Support for more information.
SimpleMessageStore
调用 `getMessageGroup()`时,`SimpleMessageStore`不再复制组。请参阅 [id="WARNING"]message-store.adoc#sms-caution了解更多信息。
The SimpleMessageStore
no longer makes a copy of the group when calling getMessageGroup()
.
See message-store.adoc#sms-caution for more information.
Web Service Outbound Gateway: encode-uri
<ws:outbound-gateway/>
现在提供了一个 encode-uri
属性,允许在发送请求之前禁用 URI 对象的编码。
The <ws:outbound-gateway/>
now provides an encode-uri
attribute to allow disabling the encoding of the URI object before sending the request.
Http Inbound Channel Adapter and Status Code
现在可使用 `status-code-expression`配置 `<http:inbound-channel-adapter>`以覆盖默认 `200 OK`状态。有关更多信息,请参见 HTTP Namespace Support。
The <http:inbound-channel-adapter>
can now be configured with a status-code-expression
to override the default 200 OK
status.
See HTTP Namespace Support for more information.
MQTT Adapter Changes
您现在可以配置 MQTT 通道适配器以连接到多台服务器 - 例如,支持高可用性 (HA)。有关详细信息,请参见 MQTT Support。
You can now configure the MQTT channel adapters to connect to multiple servers — for example, to support High Availability (HA). See MQTT Support for more information.
MQTT 消息驱动通道适配器现在支持为每个订阅指定 QoS 设置。有关更多信息,请参阅 Inbound (Message-driven) Channel Adapter。
The MQTT message-driven channel adapter now supports specifying the QoS setting for each subscription. See Inbound (Message-driven) Channel Adapter for more information.
MQTT 出站通道适配器现支持异步发送,避免阻塞,直至已确认传送。请参阅 Outbound Channel Adapter 了解更多信息。
The MQTT outbound channel adapter now supports asynchronous sends, avoiding blocking until delivery is confirmed. See Outbound Channel Adapter for more information.
现在可以在运行时以编程方式订阅和取消订阅主题。请参阅 Inbound (Message-driven) Channel Adapter 了解更多信息。
It is now possible to programmatically subscribe to and unsubscribe from topics at runtime. See Inbound (Message-driven) Channel Adapter for more information.
FTP and SFTP Adapter Changes
FTP 和 SFTP 出站通道适配器现在支持追加到远程文件以及在远程文件已存在时执行特定操作。远程文件模板现在也支持此功能,以及 rmdir()
和 exists()
。此外,远程文件模板提供对底层客户端对象的访问,从而可以访问低级 API。
The FTP and SFTP outbound channel adapters now support appending to remote files and taking specific actions when a remote file already exists.
The remote file templates now also supports this, as well as rmdir()
and exists()
.
In addition, the remote file templates provide access to the underlying client object, enabling access to low-level APIs.
有关更多信息,请参见FTP/FTPS Adapters和SFTP Adapters。
See FTP/FTPS Adapters and SFTP Adapters for more information.
Splitter and Iterator
`Splitter`组件现在支持 `Iterator`作为用于生成输出消息的结果对象。有关更多信息,请参见 Splitter。
Splitter
components now support an Iterator
as the result object for producing output messages.
See Splitter for more information.
Aggregator
Aggregator
实例现在支持一个新属性 expire-groups-upon-timeout
。请参阅 Aggregator 了解更多信息。
Aggregator
instancess now support a new attribute expire-groups-upon-timeout
.
See Aggregator for more information.
Content Enricher Improvements
我们添加了一个 null-result-expression`属性,如果 `<enricher>`返回 `null
,则计算属性并返回属性。您可以在 `<header>`和 `<property>`中添加该属性。有关更多信息,请参见 Content Enricher。
We added a null-result-expression
attribute, which is evaluated and returned if <enricher>
returns null
.
You can add it in <header>
and <property>
.
See Content Enricher for more information.
我们添加了一个 `error-channel`属性,如果 `Exception`发生在 `request-channel`之后,则用作处理错误流。这允许您返回要用于填充的替换对象。有关更多信息,请参见 Content Enricher。
We added an error-channel
attribute, which is used to handle an error flow if an Exception
occurs downstream of the request-channel
.
This lets you return an alternative object to use for enrichment.
See Content Enricher for more information.
Header Channel Registry
<header-enricher/>
元素的 <header-channels-to-string/>
子元素现在可以覆盖头通道注册表默认保留通道映射的时间。请参阅 Header Channel Registry 了解更多信息。
The <header-enricher/>
element’s <header-channels-to-string/>
child element can now override the header channel registry’s default time for retaining channel mappings.
See Header Channel Registry for more information.
Orderly Shutdown
我们改进了有序关闭算法。有关更多信息,请参见 Orderly Shutdown。
We made improvements to the orderly shutdown algorithm. See Orderly Shutdown for more information.
Management for RecipientListRouter
RecipientListRouter
现在提供一些管理操作,以在运行时配置接收者。这样一来,你现在可以在没有任何 <recipient>
的情况下配置 <recipient-list-router>
。请参阅 RecipientListRouterManagement
了解更多信息。
The RecipientListRouter
now provides several management operations to configure recipients at runtime.
With that, you can now configure the <recipient-list-router>
without any <recipient>
from the start.
See RecipientListRouterManagement
for more information.
AbstractHeaderMapper: NON_STANDARD_HEADERS token
现已提供 AbstractHeaderMapper
实现,提供了额外的 NON_STANDARD_HEADERS
令牌来映射默认情况下未映射的任何用户定义标题。有关更多信息,请参见 AMQP Message Headers。
The AbstractHeaderMapper
implementation now provides the additional NON_STANDARD_HEADERS
token to map any user-defined headers, which are not mapped by default.
See AMQP Message Headers for more information.
AMQP Channels: template-channel-transacted
针对 AMQP MessageChannel
实例,我们引入了 template-channel-transacted
属性。有关更多信息,请参见 AMQP-backed Message Channels。
We introduced the template-channel-transacted
attribute for AMQP MessageChannel
instances.
See AMQP-backed Message Channels for more information.
Syslog Adapter
默认 syslog 消息转换器现在可以选择将原始消息保留在有效负载中,同时仍然设置头。请参阅 Syslog Inbound Channel Adapter 了解更多信息。
The default syslog message converter now has an option to retain the original message in the payload while still setting the headers. See Syslog Inbound Channel Adapter for more information.
Asynchronous Gateway
除了 Promise
返回类型 mentioned earlier 之外,网关方法现在可以返回 Spring Framework 4.0 中引入的 ListenableFuture
。你还可以禁用网关中的异步处理,让下游流直接返回 Future
。请参阅 Asynchronous Gateway。
In addition to the Promise
return type mentioned earlier, gateway methods may now return a ListenableFuture
, introduced in Spring Framework 4.0.
You can also disable asynchronous processing in the gateway, letting a downstream flow directly return a Future
.
See Asynchronous Gateway.
Aggregator Advice Chain
Aggregator
和 Resequencer
现在支持 <expire-advice-chain/>
和 <expire-transactional/>
子元素,以通知 forceComplete
操作。请参阅 Configuring an Aggregator with XML 了解更多信息。
Aggregator
and Resequencer
now support <expire-advice-chain/>
and <expire-transactional/>
child elements to advise the forceComplete
operation.
See Configuring an Aggregator with XML for more information.
Outbound Channel Adapter and Scripts
现已支持 <int:outbound-channel-adapter/>
支持 <script/>
子元素。基础脚本必须具有 void
返回类型,或返回 null
。请参见 Groovy support 和 Scripting Support。
The <int:outbound-channel-adapter/>
now supports the <script/>
child element.
The underlying script must have a void
return type or return null
.
See Groovy support and Scripting Support.
Resequencer Changes
当重新排序器中的消息组超时(使用 group-timeout
或 MessageGroupStoreReaper
)时,默认情况下,迟到的消息现在会立即丢弃。请参见 Resequencer。
When a message group in a resequencer times out (using group-timeout
or a MessageGroupStoreReaper
), late arriving messages are now, by default, discarded immediately.
See Resequencer.
Optional POJO method parameter
Spring Integration 现一贯处理 Java 8 的 Optional
类型。请参阅 Configuring Service Activator。
Spring Integration now consistently handles the Java 8’s Optional
type.
See Configuring Service Activator.
QueueChannel
backed Queue type
QueueChannel
支持的 Queue type
已从 BlockingQueue
更改为更为通用的 Queue
。此更改允许使用任何外部 Queue
实现(例如 Reactor 的 PersistentQueue
)。请参阅 QueueChannel
Configuration。
The QueueChannel
backed Queue type
has been changed from BlockingQueue
to the more generic Queue
.
This change allows the use of any external Queue
implementation (for example, Reactor’s PersistentQueue
).
See QueueChannel
Configuration.
ChannelInterceptor
Changes
ChannelInterceptor
现在支持附加的 afterSendCompletion()
方法和 afterReceiveCompletion()
方法。请参见 Channel Interceptors。
The ChannelInterceptor
now supports additional afterSendCompletion()
and afterReceiveCompletion()
methods.
See Channel Interceptors.
IMAP PEEK
从版本 4.1.1 开始,如果你将 mail.[protocol].peek
JavaMail 属性显式设置为 false
(其中 [protocol]
是 imap
或 imaps
),那么行为会发生改变。请参阅 IMAP PEEK[id="IMPORTANT"]。
Since version 4.1.1 there is a change of behavior if you explicitly set the mail.[protocol].peek
JavaMail property to false
(where [protocol]
is imap
or imaps
).
See IMAP PEEK.