集成流程设计建议 [英] Advice on Integration Flow Design
问题描述
我计划实施如下集成流程:
IntegrationFlows.from(httpInboundGateway).transform(transformer-rest-api-1).transform(transformer-rest-api-2).handle(jdbc-出站).handle(http-outbound-gateway-1).get();
我想要满足的要求是:
- 尽可能多地在并行线程中运行
- 在每个端点保持消息
- 将端点设为 rest-api(使流程具有可扩展性)
让流程具有反应性是否有意义?如果是这样怎么办?我如何在每一步登录?(窃听有帮助吗?),最后,你能否提供一个具体的例子,说明在java dsl中的上述简单实现?
要使其并行,您需要考虑在端点之间使用
ExecutorChannel
:IntegrationFlows.from(httpInboundGateway).channel(c -> c.executor(myTaskExecutor())).transform(transformer-rest-api-1)
等等.
但是,由于您希望有一个持久性选项,您需要考虑使用带有持久性
MessageStore
的QueueChannel
:https://docs.spring.io/spring-integration/docs/current/reference/html/system-management-chapter.html#message-store.然后必须为每个端点提供 poller 选项,包括用于并行处理的tasExecutor
:.channel(c -> c.queue(jdbcMessageStore(), "queue1Channel")).transform(transformer-rest-api-1,e ->e.poller(p -> p.fixedDelay(100).taskExecutor(myTaskExecutor())))
要将端点作为 REST API,您只需要使用
Http.outboundGateway()
.或者对于响应式变体 -.handle()
中的WebFlux.outboundGateway()
而不是transform()
.或者直接在流程中现有的.handle(http-outbound-gateway-1)
要使流具有反应性,您需要使用
.channel(c -> c.flux()))
,但您将失去对此事的坚持.>要记录每个步骤,需要在端点之间放置一个
.log()
运算符.您的要求不清楚,无法分享一些示例...
I am planning to implement an integration flow as below:
IntegrationFlows.from(httpInboundGateway)
.transform(transformer-rest-api-1)
.transform(transformer-rest-api-2)
.handle(jdbc-outbound)
.handle(http-outbound-gateway-1)
.get();
The requirements that I want to fulfill are:
- to make this run in parallel threads as much as possible
- persist message at every end-point
- make very endpoint as rest-api (to make the flow scalable)
Does it make any sense to make the flow reactive? If so how to go about it? How do I log at every step? (Does wiretap help?), and Finally, can you please provide a concrete example that of a simple implementation for above in java dsl?
To make it parallel you need to consider to use an
ExecutorChannel
in between endpoints:IntegrationFlows.from(httpInboundGateway) .channel(c -> c.executor(myTaskExecutor())) .transform(transformer-rest-api-1)
and so on.
However since you would like to have a persistence option, you need to consider to use a
QueueChannel
with a persistentMessageStore
: https://docs.spring.io/spring-integration/docs/current/reference/html/system-management-chapter.html#message-store. Each endpoint then has to be supplied with the poller options, including atasExecutor
for parallel processing:.channel(c -> c.queue(jdbcMessageStore(), "queue1Channel")) .transform(transformer-rest-api-1, e -> e.poller(p -> p.fixedDelay(100).taskExecutor(myTaskExecutor())))
To make endpoints as REST API you just need to use
Http.outboundGateway()
. Or for reactive variant -WebFlux.outboundGateway()
in the.handle()
instead oftransform()
. Or just go ahead in the existing.handle(http-outbound-gateway-1)
in your flowTo make flow reactive you need to use a
.channel(c -> c.flux()))
, but you'l lose a persistence on the matter.To log each step, there is a
.log()
operator to be placed in between endpoints.Your requirements are not clear to share some sample...
这篇关于集成流程设计建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!