Changes between 2.0 and 2.1
请参阅 Migration Guide 以了解可能影响您应用程序的重要更改。
See the Migration Guide for important changes that might affect your applications.
New Components
2.1 版本增加了许多新组件。
Version 2.1 added a number of new components.
JSR-223 Scripting Support
在 Spring Integration 2.0 中,我们增加了对 Groovy的支持。在 Spring Integration 2.1 中,我们在实施了对 JSR-223的支持 (“Scripting for the Java™ Platform”) 后,大幅增加了对其他语言的支持。现在您可以使用支持 JSR-223 的任何脚本语言,包括:
In Spring Integration 2.0, we added support for Groovy. With Spring Integration 2.1, we expanded support for additional languages substantially by implementing support for JSR-223 (“Scripting for the Java™ Platform”). Now you have the ability to use any scripting language that supports JSR-223 including:
-
Javascript
-
Ruby and JRuby
-
Python and Jython
-
Groovy
有关更多详细信息,请参见 Scripting Support 。
For further details, see Scripting Support.
AMQP Support
Spring Integration 2.1 增加了一些用于通过使用 Advanced Message Queuing Protocol(AMQP)接收和发送消息的通道适配器。此外,Spring Integration 还提供点对点消息通道和发布-订阅消息通道,它们均由 AMQP Exchanges 和 Queues 提供支持。
Spring Integration 2.1 added several channel adapters for receiving and sending messages by using the Advanced Message Queuing Protocol (AMQP). Furthermore, Spring Integration also provides a point-to-point message channel and a publish-subscribe message channel, both of which are backed by AMQP Exchanges and Queues.
有关更多详细信息,请参见 AMQP Support 。
For further details, see AMQP Support.
MongoDB Support
从 2.1 版开始,Spring Integration 通过提供基于 MongoDB 的 MessageStore
,提供了对 MongoDB的支持。
As of version 2.1, Spring Integration provides support for MongoDB by providing a MongoDB-based MessageStore
.
有关更多详细信息,请参见 MongoDb Support 。
For further details, see MongoDb Support.
Redis Support
从 2.1 版开始,Spring Integration 通过提供基于 Redis 的 `MessageStore`以及发布-订阅消息适配器,支持 Redis,一种高级键值存储。
As of version 2.1, Spring Integration supports Redis, an advanced key-value store, by providing a Redis-based MessageStore
as well as publish-subscribe messaging adapters.
有关更多详细信息,请参见 Redis Support 。
For further details, see Redis Support.
Support for Spring’s Resource abstraction
在 2.1 版本中,我们引入了一个新的资源入站通道适配器,它建立在 Spring 的资源抽象之上,以支持跨多种实际类型的底层资源(例如,文件、URL 或类路径资源)的更大灵活性。因此,它类似于文件入站通道适配器,但更通用。
In version 2.1, we introduced a new resource inbound channel adapter that builds upon Spring’s resource abstraction to support greater flexibility across a variety of actual types of underlying resources, such as a file, a URL, or a classpath resource. Therefore, it is similar to but more generic than the file inbound channel adapter.
有关详细信息,请参见 Resource Inbound Channel Adapter。
For further details, see Resource Inbound Channel Adapter.
Stored Procedure Components
通过 Spring Integration 2.1,JDBC`模块还通过增加几个新组件来提供存储过程支持,包括入站和出站通道适配器以及一个出站网关。存储过程支持利用 Spring 的 `SimpleJdbcCall
类,因此支持以下存储过程:
With Spring Integration 2.1, the JDBC
Module also provides stored procedure support by adding several new components, including inbound and outbound channel adapters and an outbound gateway.
The stored procedure support leverages Spring’s SimpleJdbcCall
class and consequently supports stored procedures for:
-
Apache Derby
-
DB2
-
MySQL
-
Microsoft SQL Server
-
Oracle
-
PostgreSQL
-
Sybase
存储过程组件还支持以下数据库的 SQL 函数:
The stored procedure components also support SQL functions for the following databases:
-
MySQL
-
Microsoft SQL Server
-
Oracle
-
PostgreSQL
有关更多详细信息,请参见 Stored Procedures 。
For further details, see Stored Procedures.
XPath and XML Validating Filter
Spring Integration 2.1 提供了一个基于 XPath 的新消息过滤器。它是“XML”模块的一部分。借助 XPath 过滤器,您可以使用 XPath 表达式过滤消息。我们还增加了 XML 验证过滤器的文档。
Spring Integration 2.1 provides a new XPath-based message filter.
It is part of the XML
module.
The XPath filter lets you filter messages by using XPath Expressions.
We also added documentation for the XML validating filter.
有关更多详细信息,请参见 Using the XPath Filter 和 XML Validating Filter 。
For more details, see Using the XPath Filter and XML Validating Filter.
Payload Enricher
从 Spring Integration 2.1 开始,我们增加了有效负载增强器。有效负载增强器定义了一个端点,该端点通常将 Message
传递给公开的请求通道,然后期望接收回复消息。然后回复消息成为用于评估表达式以增强目标有效负载的根对象。
Since Spring Integration 2.1, we added the payload enricher.
A payload enricher defines an endpoint that typically passes a Message
to the exposed request channel and then expects a reply message.
The reply message then becomes the root object for evaluation of expressions to enrich the target payload.
有关详细信息,请参见 Payload Enricher。
For further details, see Payload Enricher.
FTP and SFTP Outbound Gateways
Spring Integration 2.1 提供了两个新的出站网关,以便与远程文件传输协议 (FTP) 或安全文件传输协议 (SFT) 服务器进行交互。这两个网关可让您直接执行一组有限的远程命令。
Spring Integration 2.1 provides two new outbound gateways to interact with remote File Transfer Protocol (FTP) or Secure File Transfer Protocol (SFT) servers. These two gateways let you directly execute a limited set of remote commands.
例如,您可以使用这些出站网关来列出、检索和删除远程文件,然后让 Spring Integration 消息流继续处理远程服务器的响应。
For instance, you can use these outbound gateways to list, retrieve, and delete remote files and have the Spring Integration message flow continue with the remote server’s response.
有关更多详细信息,请参见 FTP Outbound Gateway 和 SFTP Outbound Gateway 。
For further details, see FTP Outbound Gateway and SFTP Outbound Gateway.
FTP Session Caching
从版本 2.1 开始,我们引入了更多灵活的管理远程文件适配器(例如,FTP、SFTP 等)的会话的方式。
As of version 2.1, we have exposed more flexibility with regards to session management for remote file adapters (for example, FTP, SFTP, and others).
具体来说,我们弃用了 cache-sessions
属性(可通过 XML 命名空间支持获得)。作为替代,我们在 CachingSessionFactory
上添加了 sessionCacheSize
和 sessionWaitTimeout
属性。
Specifically, we deprecated the cache-sessions
attribute (which is available via the XML namespace support).
As an alternative, we added the sessionCacheSize
and sessionWaitTimeout
attributes on the CachingSessionFactory
.
有关更多详细信息,请参见 FTP Session Caching 和 SFTP Session Caching 。
For further details, see FTP Session Caching and SFTP Session Caching.
Framework Refactoring
我们在多个方面重新设计了 Spring Integration 框架,这些内容在本部分全部进行了描述。
We refactored the Spring Integration framework in a number of ways, all described in this section.
Standardizing Router Configuration
我们在 Spring Integration 2.1 中标准化了所有路由器实现中的路由器参数,以便提供更一致的用户体验。
We standardized router parameters across all router implementations with Spring Integration 2.1 to provide a more consistent user experience.
在 Spring Integration 2.1 中,我们删除了 ignore-channel-name-resolution-failures
属性,而赞成将其行为与 resolution-required
属性合并。此外,resolution-required
属性现在默认为 true
。
In Spring Integration 2.1, we removed the ignore-channel-name-resolution-failures
attribute in favor of consolidating its behavior with the resolution-required
attribute.
Also, the resolution-required
attribute now defaults to true
.
从 Spring Integration 2.1 开始,如果未定义默认输出通道,则路由器不再静默丢弃任何消息。这意味着,默认情况下,路由器现在至少需要一个已解析通道(如果未设置 default-output-channel
),并且,如果未确定通道(或发送尝试不成功),则默认情况下抛出 MessageDeliveryException
。
Starting with Spring Integration 2.1, routers no longer silently drop any messages if no default output channel was defined.
This means that, by default, routers now require at least one resolved channel (if no default-output-channel
was set) and, by default, throw a MessageDeliveryException
if no channel was determined (or an attempt to send was not successful).
但是,如果您确实希望静默丢弃消息,则可以设置 default-output-channel="nullChannel"
。
If, however, you do want to drop messages silently, you can set default-output-channel="nullChannel"
.
随着路由器参数的标准化和前面描述的参数的合并,基于 Spring Integration 的较旧应用程序可能会损坏。
With the standardization of router parameters and the consolidation of the parameters described earlier, older Spring Integration based applications may break.
有关更多详细信息,请参见 Routers
。
For further details, see Routers
.
XML Schemas updated to 2.1
Spring Integration 2.1 包含一个更新的 XML Schema(2.1 版)。它提供了许多改进,例如路由器标准化 discussed earlier。
Spring Integration 2.1 ships with an updated XML Schema (version 2.1). It provides many improvements, such as the Router standardizations discussed earlier.
从现在开始,开发人员必须始终声明最新的 XML 模式(当前版本 2.1)。或者,他们可以使用无版本的模式。通常,最佳选择是使用无版本的命名空间,因为这些命名空间会自动使用 Spring Integration 的最新可用版本。
From now on, developers must always declare the latest XML schema (currently version 2.1). Alternatively, they can use the version-less schema. Generally, the best option is to use version-less namespaces, as these automatically use the latest available version of Spring Integration.
以下示例声明了一个无版本的 Spring Integration 命名空间:
The following example declares a version-less Spring Integration namespace:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/integration
https://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd">
...
</beans>
以下示例声明了一个具有显式版本的 Spring Integration 命名空间:
The following example declares a Spring Integration namespace with an explicit version:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/integration
https://www.springframework.org/schema/integration/spring-integration-2.2.xsd
http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd">
...
</beans>
旧的 1.0 和 2.0 模式仍然存在。但是,如果应用程序上下文仍引用这些弃用模式之一,则验证器会在初始化时失败。
The old 1.0 and 2.0 schemas are still there. However, if an application context still references one of those deprecated schemas, the validator fails on initialization.
Source Control Management and Build Infrastructure
版本 2.1 为源代码管理和构建基础设施引入了一些更改。本部分涵盖了这些更改。
Version 2.1 introduced a number of changes to source control management and build infrastructure. This section covers those changes.
Source Code Now Hosted on Github
从 2.0 版本开始,Spring 集成项目使用 Git 进行版本控制。为了进一步提高社区影响力,该项目已从 SpringSource 托管 Git 存储库迁移到 Github 。Spring 集成 Git 存储库位于: spring-integration 。
Since version 2.0, the Spring Integration project uses Git for version control. To increase community visibility even further, the project was moved from SpringSource hosted Git repositories to Github. The Spring Integration Git repository is located at: spring-integration.
对于该项目,我们还改进了提供代码贡献的过程。此外,我们确保每项提交都会进行同行评审。事实上,核心提交者现在遵循与贡献者相同的过程。有关更多详细信息,请参见 Contributing 。
For the project, we also improved the process of providing code contributions. Further, we ensure that every commit is peer-reviewed. In fact, core committers now follow the same process as contributors. For more details, see Contributing.
Improved Source Code Visibility with Sonar
为了更好地提供源代码可见性,并因此监视 Spring 集成的源代码质量,我们设置了 Sonar 实例。我们每晚收集指标,并使其在 sonar.spring.io 处可用。
In an effort to provide better source code visibility and consequently to monitor the quality of Spring Integration’s source code, we set up an instance of Sonar. We gather metrics nightly and make them available at sonar.spring.io.
New Samples
对于 Spring 集成的 2.1 版本,我们还扩展了 Spring 集成示例项目并增加了许多新示例,例如涵盖 AMQP 支持的示例、展示新有效负载填充器的示例、演示用于测试 Spring 集成流片段的技术的示例以及针对 Oracle 数据库执行存储过程的示例。有关详细信息,请访问 spring-integration-samples 。
For the 2.1 release of Spring Integration, we also expanded the Spring Integration Samples project and added many new samples, such as samples that cover AMQP support, a sample that showcases the new payload enricher, a sample illustrating techniques for testing Spring Integration flow fragments, and a sample for executing stored procedures against Oracle databases. For details, visit spring-integration-samples.