0

I have a Camel route that listens to an ActiveMQ. I have added a delay of 10 seconds to because it needs to be certain that another process has completed before commencing. This has been achieved by adding the delayer attribute: -

<camel:route id="packageRetrievalContentAndSendToS3" delayer="10000">
    <camel:from uri="activemq:{{ccs.activemq.queue.prefix}}.sr.package.and.send"/>

    ....extra steps....

</camel:route>

This works fine, but the trouble is, my route now times out! Message below.

Atomikos:8] c.a.icatch.imp.ActiveStateHandler        : Timeout/setRollbackOnly of ACTIVE coordinator !

I would really appreciate any advice as to how to address this. Ideally I would like to increase the timeout on that route. Many thanks

Jon H
  • 394
  • 3
  • 17
  • 3
    Can you elaborate about this another process that you have to wait for? It's hard to advice without knowing what exactly is the reason for waiting. If you need to process a message (which is naturally asynchronous), but also wait for some condition (waiting is synchronous), this smells like an architectural issue, and maybe you shouldn't even have received this message in the first place before the process is finished. Also, increasing the transaction timeout means you're significantly increasing the transaction boundary for no particular reason, which is usually bad. – Forketyfork Jan 10 '20 at 12:14
  • Thank you @SergeiPetunin. This makes perfect sense re synchronous/asynchronous. I think I need to look at the design/architecture and see if there is a better way of implementing this. – Jon H Jan 10 '20 at 16:03

1 Answers1

2

As @sergei-petunin already commented, you try to compensate a design issue by waiting.

Your route should not receive a message before the thing you wait for is finished. That means that

  1. the thing you wait for receives a message and does what it has to do
  2. then it sends a message to your route
  3. then your route processes the message without waiting

So all partial steps of the process are done asynchronous and sequentially because they depend on each other. This is also known as the Pipes and Filters EIP.

If you have control over the thing you wait for, you can easily change the design by putting a message queue between the thing you wait for and your route.

burki
  • 6,741
  • 1
  • 15
  • 31
  • Thanks to sergei-petunin and yourself, @burki, I have now completely re-engineered my route. It now contains lots of pipes! And I haven't seen a timeout since. I thank you both very much indeed. I do now have a further question, so I may add that here in the next day or two if I don't find a solution myself! – Jon H Jan 13 '20 at 11:35