Changes between Versions 1.0 and 2.0
请参阅 Migration Guide 了解可能影响您应用程序的重要更改。
See the Migration Guide for important changes that might affect your applications.
Spring 3 support
Spring Integration 2.0 构建在 Spring 3.0.5 之上,并向我们的用户提供了其许多功能。
Spring Integration 2.0 is built on top of Spring 3.0.5 and makes many of its features available to our users.
[[2.0-spel-support]]=== 对 Spring 表达式语言 (SpEL) 的支持
[[2.0-spel-support]] === Support for the Spring Expression Language (SpEL)
现在,你可以在转换器、路由器、过滤器、分隔器、聚合器、服务激活器、标头增强器和 Spring Integration 核心命名空间的许多其他元素以及各种适配器中使用 SpEL 表达式。该指南包括许多示例。
You can now use SpEL expressions within the transformer, router, filter, splitter, aggregator, service-activator, header-enricher, and many more elements of the Spring Integration core namespace as well as within various adapters. This guide includes many samples.
Conversion Service and Converter
现在,在配置许多 Spring Integration 组件(如 Datatype channel)时,您可以受益于 Spring 提供的转换服务支持。请参阅 Message Channel Implementations 和 Service Activator。此外,上一小节提到的 SpEL 支持也依赖于转换服务。因此,您只需注册转换器,并可以在任何使用 SpEL 表达式的地方利用它们。
You can now benefit from the conversion service support provided with Spring while configuring many Spring Integration components, such as a Datatype channel. See Message Channel Implementations and Service Activator. Also, the SpEL support mentioned in the previous point also relies upon the conversion service. Therefore, you can register converters once and take advantage of them anywhere you use SpEL expressions.
TaskScheduler
and Trigger
Spring 3.0 定义了与计划相关的两个新策略:TaskScheduler
和 Trigger
。Spring Integration(使用大量计划)现在建立在这些之上。事实上,Spring Integration 1.0 最初定义了一些已迁移到 Spring 3.0 的核心 API 中的组件(例如 CronTrigger
)。现在,您可以在整个应用程序上下文中重用相同的组件的优势(不仅仅是 Spring Integration 配置)。我们还通过提供用于直接配置速率、延迟、cron 表达式和触发器引用的属性,大大简化了 Spring Integration 投票器的配置。有关示例配置,请参阅 Channel Adapter。
Spring 3.0 defines two new strategies related to scheduling: TaskScheduler
and Trigger
.
Spring Integration (which uses a lot of scheduling) now builds upon these.
In fact, Spring Integration 1.0 had originally defined some of the components (such as CronTrigger
) that have now been migrated into Spring 3.0’s core API.
Now you can benefit from reusing the same components within the entire application context (not just Spring Integration configuration).
We also greatly simplified configuration of Spring Integration pollers by providing attributes for directly configuring rates, delays, cron expressions, and trigger references.
See Channel Adapter for sample configurations.
RestTemplate
and HttpMessageConverter
我们出站的 HTTP 适配器现在委托给 Spring 的 RestTemplate
,以执行 HTTP 请求并处理其响应。这也意味着您可以重复使用任何自定义 `HttpMessageConverter`实现。有关更多详细信息,请参阅 HTTP Outbound Components。
Our outbound HTTP adapters now delegate to Spring’s RestTemplate
for executing the HTTP request and handling its response.
This also means that you can reuse any custom HttpMessageConverter
implementations.
See HTTP Outbound Components for more details.
Enterprise Integration Pattern Additions
另外,在 2.0 中,我们增加了对 Hohpe 和 Woolf 的 Enterprise Integration Patterns 书中描述的更多模式的支持。
Also in 2.0, we have added support for even more of the patterns described in Hohpe and Woolf’s Enterprise Integration Patterns book.
Message History
我们现在提供对 message history 模式的支持,让您可以跟踪所有遍历的组件,包括每个信道和端点的名称以及该遍历的时间戳。有关更多详细信息,请参阅 Message History。
We now provide support for the message history pattern, letting you keep track of all traversed components, including the name of each channel and endpoint as well as the timestamp of that traversal. See Message History for more details.
Message Store
我们现在提供对 message store 模式的支持。消息存储提供了一种代表任何范围超出单个事务的进程(例如聚合器和重新排序器)持久化消息的策略。本指南的许多部分包括有关如何使用消息存储的示例,因为它影响了 Spring Integration 的多个区域。有关更多详细信息,请参阅 Message Store、Claim Check、Message Channels、Aggregator、JDBC Support 和 Resequencer。
We now provide support for the message store pattern. The message store provides a strategy for persisting messages on behalf of any process whose scope extends beyond a single transaction, such as the aggregator and the resequencer. Many sections of this guide include samples of how to use a message store, as it affects several areas of Spring Integration. See Message Store, Claim Check, Message Channels, Aggregator, JDBC Support`", and Resequencer for more details.
Claim Check
我们添加了 claim check 模式的一个实现。声明检查模式背后的想法是您可以交换消息有效负载以获取 “claim ticket”。这可以让您在跨信道发送消息时减少带宽并避免潜在的安全问题。有关更多详细信息,请参阅 Claim Check。
We have added an implementation of the claim check pattern. The idea behind the claim check pattern is that you can exchange a message payload for a “claim ticket”. This lets you reduce bandwidth and avoid potential security issues when sending messages across channels. See Claim Check for more details.
Control Bus
我们提供了 control bus 模式的实现,它让您可以使用消息传递来管理和监控端点和信道。这些实现包括基于 SpEL 的方法和运行 Groovy 脚本的方法。有关更多详细信息,请参阅 Control Bus 和 Control Bus。
We have provided implementations of the control bus pattern, which lets you use messaging to manage and monitor endpoints and channels. The implementations include both a SpEL-based approach and one that runs Groovy scripts. See Control Bus and Control Bus for more details.
New Channel Adapters and Gateways
我们在 Spring Integration 2.0 中添加了几个新的通道适配器和消息传递网关。
We have added several new channel adapters and messaging gateways in Spring Integration 2.0.
TCP and UDP Adapters
我们添加了用于通过 TCP 和 UDP Internet 协议接收和发送消息的信道适配器。有关更多详细信息,请参阅 TCP and UDP Support。另请参阅以下博客: “Using UDP and TCP Adapters in Spring Integration 2.0 M3”。
We have added channel adapters for receiving and sending messages over the TCP and UDP internet protocols. See TCP and UDP Support for more details. See also the following blog: “Using UDP and TCP Adapters in Spring Integration 2.0 M3”.
Twitter Adapters
Twitter 适配器提供对发送和接收 Twitter 状态更新以及直接消息的支持。您还可以在入站通道适配器中执行 Twitter 搜索。有关详情,请参阅 Spring Integration Social Twitter。
Twitter adapters provides support for sending and receiving Twitter status updates as well as direct messages. You can also perform Twitter Searches with an inbound channel adapter. See Spring Integration Social Twitter for more details.
XMPP Adapters
新的 XMPP 适配器同时支持聊天消息和在线状态事件。有关更多详细信息,请参阅 XMPP Support。
The new XMPP adapters support both chat messages and presence events. See XMPP Support for more details.
FTP and FTPS Adapters
现在可以使用 FTP 和 FTPS 上的入站和出站文件传输支持。有关更多详细信息,请参阅 FTP/FTPS Adapters。
Inbound and outbound file transfer support over FTP and FTPS is now available. See FTP/FTPS Adapters for more details.
SFTP Adapters
现在可以使用 SFTP 上的入站和出站文件传输支持。有关更多详细信息,请参阅 SFTP Adapters。
Inbound and outbound file transfer support over SFTP is now available. See SFTP Adapters for more details.
Feed Adapters
我们还添加了用于接收新闻提要(ATOM 和 RSS)的通道适配器。有关更多详细信息,请参阅 Feed Adapter。
We have also added channel adapters for receiving news feeds (ATOM and RSS). See Feed Adapter for more details.
Other Additions
Spring Integration 添加了许多其他特性。本节介绍它们。
Spring Integration adds a number of other features. This section describes them.
Groovy Support
Spring Integration 2.0 添加了 Groovy 支持,允许您使用 Groovy 脚本语言提供集成和业务逻辑。有关更多详细信息,请参阅 Groovy support。
Spring Integration 2.0 added Groovy support, letting you use the Groovy scripting language to provide integration and business logic. See Groovy support for more details.
Map Transformers
这些对称转换器将有效负载对象转换到 `Map`对象以及从 `Map`对象转换。有关更多详细信息,请参阅 Transformer。
These symmetrical transformers convert payload objects to and from Map
objects.
See Transformer for more details.
JSON Transformers
这些对称转换器将有效负载对象转换到 JSON 以及从 JSON 转换。有关更多详细信息,请参阅 Transformer。
These symmetrical transformers convert payload objects to and from JSON. See Transformer for more details.
Serialization Transformers
这些对称转换器将有效负载对象转换到字节数组以及从字节数组转换。它们还支持 Spring 3.0.5 添加的序列化器和反序列化器策略接口。有关更多详细信息,请参阅 Transformer。
These symmetrical transformers convert payload objects to and from byte arrays. They also support the serializer and deserializer strategy interfaces that Spring 3.0.5 added. See Transformer for more details.
Framework Refactoring
核心 API 进行了重大重构,以便让其变得更简单、更易用。虽然我们预计对开发人员的影响很小,但您应阅读本文档以了解更改的内容。具体来说,您应阅读 Dynamic Routers、Messaging Gateways、HTTP Outbound Components、Message和 Aggregator。如果您直接依赖于某些关键组件 (Message
、MessageHeaders
、MessageChannel
、`MessageBuilder`和其它组件),则需要更新任何导入语句。我们对某些软件包进行了重新构建,以便在避免循环依赖项的情况下(避免此类 "`tangles`"是此框架的策略),我们可获得扩展域模型所需的灵活性。
The core API went through some significant refactoring to make it simpler and more usable.
Although we anticipate that the impact to developers should be minimal, you should read through this document to find what was changed.
Specifically, you should read Dynamic Routers, Messaging Gateways, HTTP Outbound Components, Message, and Aggregator.
If you directly depend on some of the core components (Message
, MessageHeaders
, MessageChannel
, MessageBuilder
, and others), you need to update any import statements.
We restructured some packaging to provide the flexibility we needed for extending the domain model while avoiding any cyclical dependencies (it is a policy of the framework to avoid such “tangles”).
New Source Control Management and Build Infrastructure
使用 Spring Integration 2.0,我们切换构建环境以使用 Git 来进行源代码控制。如需访问我们的存储库,请访问 [role="bare"][role="bare"]https://git.springsource.org/spring-integration。我们还切换了我们的构建系统至 Gradle。
With Spring Integration 2.0, we switched our build environment to use Git for source control. To access our repository, visit [role="bare"]https://git.springsource.org/spring-integration. We have also switched our build system to Gradle.
New Spring Integration Samples
使用 Spring Integration 2.0,我们已将样本从我们的主要发行版中分离出来。请阅读以下博客以获取更多信息: New Spring Integration Samples。我们还创建了许多新样本,包括针对每个新适配器的样本。
With Spring Integration 2.0, we have decoupled the samples from our main release distribution. Please read the following blog to get more information: New Spring Integration Samples. We have also created many new samples, including samples for every new adapter.
Spring Tool Suite Visual Editor for Spring Integration
最新的 SpringSource Tool Suite 版本包含针对 Spring Integration 的一个新颖的视觉编辑器。如果您尚未使用 STS,可在 Spring Tool Suite处下载。
There is an amazing new visual editor for Spring Integration included within the latest version of SpringSource Tool Suite. If you are not already using STS, you can download it at Spring Tool Suite.