发布于 2016-09-16 01:21:32 | 186 次阅读 | 评论: 0 | 来源: 网友投递
Spring Integration Spring消息通信
Spring Integration能在基于Spring的应用中进行简单的消息通信,并通过简单的适配器与外部系统集成。这些适配器提供了一个更高级别的抽象,超越 了Spring对远程调用、消息和调度的支持。其主要目标是在保持关注点分离的同时,为构建企业集成解决方案提供一个简单的模型,该模型对产出可维护、可 测试的代码来说是必不可少的。
Java DSL for Spring Integration 1.2 Milestone 2 发布了,目前迭代更新的一些亮点:
JPA support
@Autowired
private EntityManagerFactory entityManagerFactory;
@Bean
public IntegrationFlow pollingAdapterFlow() {
return IntegrationFlows
.from(Jpa.inboundAdapter(this.entityManagerFactory)
.entityClass(StudentDomain.class)
.maxResults(1)
.expectSingleResult(true),
e -> e.poller(p -> p.trigger(new OnlyOnceTrigger())))
.channel(c -> c.queue("pollingResults"))
.get();
}
@Bean
public IntegrationFlow updatingGatewayFlow() {
return f -> f
.handle(Jpa.updatingGateway(this.entityManagerFactory),
e -> e.transactional(true))
.channel(c -> c.queue("persistResults"));
}
@Bean
public IntegrationFlow retrievingGatewayFlow() {
return f -> f
.handle(Jpa.retrievingGateway(this.entityManagerFactory)
.jpaQuery("from Student s where s.id = :id")
.expectSingleResult(true)
.parameterExpression("id", "payload"))
.channel(c -> c.queue("retrieveResults"));
}
Mid-flow transaction support
Scatter-Gather support
More routers improvements
点击查看提交记录以了解更多
发行说明:
下载地址: