How to use asynchronous routes in Apache Camel Blueprint


How to use asynchronous routes in Apache Camel Blueprint



I have a route that has to be asynchronously consumed and I'm using an direct component to refers to it as an alias.


<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&amp;idempotent=false</constant>
</pollEnrich>
<to uri="kafka:customer-interactions-issues-relationships?brokers=localhost:9092"/>
</route>



That route has to be consumed by:


<route id="1"><from uri="timer://foo?fixedRate=true&amp;period=1&amp;repeatCount=1000"/><to uri="direct:test"/></route>
<route id="2"><from uri="timer://foo?fixedRate=true&amp;period=1&amp;repeatCount=1000"/><to uri="direct:test"/></route>
<route id="3"><from uri="timer://foo?fixedRate=true&amp;period=1&amp;repeatCount=1000"/><to uri="direct:test"/></route>
<route id="4"><from uri="timer://foo?fixedRate=true&amp;period=1&amp;repeatCount=1000"/><to uri="direct:test"/></route>



I would like that each consumer route requests 1000x the mock content of producer_CUSTOMER_INTERACTIONS_ISSUES_RLATIONSHIPS_Topic asyncrhonously, but, right now, it's syncrhonous as follows:


producer_CUSTOMER_INTERACTIONS_ISSUES_RLATIONSHIPS_Topic



enter image description here



I've read about a SEDA component in Camel Documentation, but there isn't any example about how to use it in Blueprints :(




1 Answer
1



In order to help other people that need to do something like this, I've solved this problem using:


<route id="1"><from uri="timer://foo?fixedRate=true&amp;period=1&amp;repeatCount=1000&amp;delay=-1"/><to uri="direct:test"/></route>



I just added delay=-1 to force it run asynchronously.


delay=-1



I really don't know if it is the beast approach. If someone else has a better answer, please, post it to help =)






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Export result set on Dbeaver to CSV

Opening a url is failing in Swift