Java 如何在Apache Camel Blueprint中使用异步路由
我有一个必须异步使用的路由,我使用一个直接组件将其作为别名引用Java 如何在Apache Camel Blueprint中使用异步路由,java,apache-camel,osgi,blueprint,Java,Apache Camel,Osgi,Blueprint,我有一个必须异步使用的路由,我使用一个直接组件将其作为别名引用 <route id="producer_CUSTOMER_INTERACTIONS_ISSUES_RELATIONSHIPS_Topic"> <from uri="direct:test"/> <pollEnrich aggregateOnException="false" id="pollEnrich1" timeout="-1">
<route id="producer_CUSTOMER_INTERACTIONS_ISSUES_RELATIONSHIPS_Topic">
<from uri="direct:test"/>
<pollEnrich aggregateOnException="false" id="pollEnrich1" timeout="-1">
<constant>file:mock/customer-interactions-issues-relationships?noop=true&idempotent=false</constant>
</pollEnrich>
<to uri="kafka:customer-interactions-issues-relationships?brokers=localhost:9092"/>
</route>
文件:模拟/客户互动问题关系?noop=true&;幂等元=假
该路线必须由以下人员使用:
<route id="1"><from uri="timer://foo?fixedRate=true&period=1&repeatCount=1000"/><to uri="direct:test"/></route>
<route id="2"><from uri="timer://foo?fixedRate=true&period=1&repeatCount=1000"/><to uri="direct:test"/></route>
<route id="3"><from uri="timer://foo?fixedRate=true&period=1&repeatCount=1000"/><to uri="direct:test"/></route>
<route id="4"><from uri="timer://foo?fixedRate=true&period=1&repeatCount=1000"/><to uri="direct:test"/></route>
我希望每个消费者路由请求1000倍于producer\u CUSTOMER\u INTERACTIONS\u ISSUES\RLATIONSHIPS\u Topic
的模拟内容,但现在,它是同步的,如下所示:
我在Camel文档中读过SEDA组件,但没有任何关于如何在蓝图中使用它的示例:(为了帮助其他需要这样做的人,我使用以下方法解决了此问题:
<route id="1"><from uri="timer://foo?fixedRate=true&period=1&repeatCount=1000&delay=-1"/><to uri="direct:test"/></route>
我刚刚添加了delay=-1
,以强制它异步运行
我真的不知道这是否是野兽式的方法。如果其他人有更好的答案,请将其发布到help=)你说它们同步运行是什么意思?它们一次一个地在空中运行。但那是因为你将它们安排在同一时间段,对吗?他们应该在飞机上。您可以使用计时器创建事件并将其路由到线程路由中。我想这就是你想要实现的目标。是的,但我需要的是,每一条涉及到生产者、客户、互动、问题、关系和主题的路线都要同时进行P