Spring Integration 的第六个里程碑版本 5.0 (5.0.0.M6)发布了。Spring Integration 能在基于 Spring 的应用中进行简单的消息通信,并通过简单的适配器与外部系统集成。这些适配器提供了一个更高级别的抽象,超越了 Spring 对远程调用、消息和调度的支持。其主要目标是在保持关注点分离的同时,为构建企业集成解决方案提供一个简单的模型,该模型对产出可维护、可测试的代码来说是必不可少的。
这个版本中有 19 JIRAs (和一些GitHub问题),包括错误修复和一些新功能。M46 相比于M5 有如下亮点:
The Spring WebFlux based Reactive Channel Adapters are provided for the HTTP server side:
@Bean public IntegrationFlow sseFlow() { return IntegrationFlows .from(Http.inboundReactiveGateway("/sse") .requestMapping(m -> m.produces(MediaType.TEXT_EVENT_STREAM_VALUE))) .handle((p, h) -> Flux.just("foo", "bar", "baz")) .get(); }
This sample demonstrate how we can configure Server Side Events with the Spring Integration Channel Adapter which is fully based on the WebFlux
foundation and performs integration flow execution on demand, back-pressure manner.
The IntegrationFlow
can now start from any interface, even without @MessagingGateway
annotation. That annotation is synthesized on background with default properties by the AnnotationGatewayProxyFactoryBean
. This trick opens for us possibility to start IntegrationFlow
from the java.util.function
interfaces - Function
, Consumer
and Supplier
. And that, in turn, gives us an interesting approach where we can expose an IntegrationFlow
as a Function using new Spring Cloud Function
project:
@Bean public IntegrationFlow uppercase(MongoOperations mongoOperations) { return IntegrationFlows.from(Function.class) .handle(MongoDb.outboundGateway(mongoOperations) .queryFunction(msg -> Query.query(Criteria.where("name") .is(msg.getPayload()))) .collectionNameExpression("headers.collection") .expectSingleResult(true) .entityClass(Person.class)) .get(); }
a new JdbcMetadataStore
is available now. This implementation is truly transaction-based and if subsequent flow after (S)FTP polling causes some error, no entries is stored in the DB because of transaction rollback.
The preserveTimestamp
algorithm for (S)FTP Inbound Channel Adapters has been fixed to throw an exception when local temporary copy cannot be renamed to the original file because the last one is busy in another process.
完整更新内容请查看 发行说明 。
>>>【评论有礼】7月10日-31日在下方评论资讯,即有机会获得 9 活跃积分和开源中国实物周边。活动详情