取得领先
VMware 提供培训和认证,加速你的进步。
了解更多尊敬的 Spring 社区:
我很高兴地宣布,Spring Integration 的 Java DSL 1.2 RC1
现已发布。
自上次的 Milestone 2 发布以来,我们收到了关于新功能的良好深入反馈,并且为了反映实际需求,一些 API 已经发生了变化。
像往常一样,非常感谢所有创建 issue、提交 Pull Request、提供反馈或仅仅在 StackOverflow 上提问的人。
Artifact org.springframework.integration:spring-integration-java-dsl:1.2.0.RC1
已在 Milestone repo 中提供。所以,请抓紧最后机会试用它,并提出任何反馈 (在 GH issue 中)!
现在介绍 1.2 RC1
中的变化
errorChannel
现在我们可以在 Poller 定义上指定 errorChannel
。以前我们需要配置完整的、独立的 MessagePublishingErrorHandler
。
e -> e.poller(Pollers.fixedDelay(100)
.errorChannel(filePollingErrorChannel())
取代
@Bean
public ErrorHandler filePollingErrorHandler() {
MessagePublishingErrorHandler errorHandler =
new MessagePublishingErrorHandler();
errorHandler.setDefaultErrorChannel(filePollingErrorChannel());
return errorHandler;
}
...
e -> e.poller(Pollers.fixedDelay(100)
.errorHandler(filePollingErrorHandler())
在 Spring Integration Core 中引入对 MessagePublishingErrorHandler
的 late-binding 支持后,现在只需要 MessageChannel
的 bean 名称就会更容易。
Files.splitter()
规范现在提供了更多配置底层 FileSplitter
的选项。
.split(Files.splitter()
.markers(false)
.applySequence(true)
.charset("UTF-8"))
手动流注册过程经过了一些改进
IntegrationFlowContext.registration(IntegrationFlow)
方法返回 IntegrationFlowRegistrationBuilder
,以便在注册 IntegrationFlow
bean 和所有依赖组件时提供更多选项;
IntegrationFlowRegistrationBuilder.register()
调用会产生一个 IntegrationFlowRegistration
对象。这个对象提供了一些有用的 IntegrationFlow
属性,并允许控制与其关联的 IntegrationFlow
的生命周期;
你现在可以添加额外的 bean 进行注册,这些 bean 是提供的 IntegrationFlow
所必需的。例如,Ftp.outboundAdapter()
需要 DefaultFtpSessionFactory
。它们会与它们关联的 IntegrationFlow
一起被销毁并从 ApplicationContext
中移除。
this.integrationFlowContext.registration(myFlow) .id("myFlow") .autoStartup(false) .addBean(new Foo()) .addBean("bar", new Bar()) .register();
更多信息请参阅 Gary Russell 关于动态 TCP 客户端的精彩示例。
我们决定放弃对 Apache Kafka 0.8.x
的支持(Spring Integration for Apache Kafka 1.3.x
),转而支持 Apache Kafka 0.9.x
和 0.10.x
。最近引入的 Kafka09
已被删除,其内容已移至 Kafka
工厂。目前相关的依赖是 Spring Integration for Apache Kafka 2.1.x
,它基于 Spring for Apache Kafka 1.1.x
提供对 Apache Kafka 0.10.x
的支持。同时,同一个 Kafka
DSL 工厂和依赖组件也可以在 classpath 中使用之前的 Spring Integration for Apache Kafka 2.0.x
版本。
对 Apache Kafka 0.8.x
的支持可以通过直接使用 Spring Integration for Apache Kafka 1.3.x
适配器来实现。或者你可以简单地将 Java DSL 1.1
中的 org.springframework.integration.dsl.kafka
包复制到你的项目中,并继续受益于 Kafka
工厂的流畅构建器 API!
我们预计将在大约一周内发布 1.2
版本的通用可用版本(GA)。之后,spring-integration-java-dsl
将肯定会迁移到 Spring Integration Core 5.0
和 Java 8 代码库。当前的 1.2
版本仍将得到支持,但仅限于错误修复。