0
votes

Is there a way using which we can stop the Camel route if we don't have any more message in ActiveMQ? My required scenario.

  1. Fetch all the message from ActiveMQ queue and process them.
  2. Poll for 2-3 more times to check if we have any other new message, is yes execute step #1.
  3. If no message in present stop the route and start it back after say 5 min (which I guess can be achieved by Polling Strategy).
1
Can you also explain WHY you want to do this? Messaging applications are typically event driven, i.e. when a message arrives, it is processed. The message polling approach you describe is probably possible but it somehow "hurts the concepts" and therefore you have more work to do it that way.burki
As far as I understand Camel ActiveMQ component polls the Queue, and as our application is in cloud we want to minimized the pollingHemant Kumar Bothra

1 Answers

1
votes

Have a look at this answer. It polls the queue with a scheduler and a polling strategy (POJO).

  • With the scheduler you can choose the interval of polling
  • With the timeout of the polling strategy consumer you can stop consuming (e.g. if no message arrives for 5 seconds the queue is probably empty)

If you want to stop/start the consumer completely, you can add Camel Control Bus to the mix. You could then start and stop the consumer route.