You can use the dynamic router to keep looping over an endpoint(s) http://camel.apache.org/dynamic-router.html
And then remember to return null when you do not need to loop anymore. Or as Abhijit mentioned, you can always use a java bean, and do your logic there, and use the producer template to easily send a message to an endpoint. And from the java bean you have all the power of the java programming language to do what you want. On Wed, Nov 13, 2013 at 6:54 PM, Abhijit Kulkarni <[email protected]> wrote: > Hello, > > > > I have a following situation to be handled through a camel route - > > > > 1. An internal application (application 'A') sends a message in a > queue (Active MQ) where my camel route shall listen on. > > 2. The Route shall then process the message (Data Enrichment and Data > Translation from XML to JSON) > > 3. And calls an external system - this is a REST service call over > HTTP (using POST method) and JSON as a body. As a response of this service > call I receive HTTP 200 with empty body. > > 4. As a result of this REST service call, in the external application > a business process is triggered, which could take from 1 second to several > minutes to complete. (even an hour depending upon the input data passed to > it, there could be manual interaction involved in the business process.). > > 5. The external System exposes another service to obtain the status of > this business process (which is again a REST service over HTTP with GET > method) - so here now the task is to keep calling this service after some > time interval till I receive the final status 'Active' or 'Failed' (which is > a field named status in the response JSON). If the business process has not > ended, the intermediate statuses will be returned. Please note that this > status enquiry service always returns HTTP 200 (whether it is returning the > final status or intermediate status or a failure in form of a JSON body) > unless it is down (404 in that case). > > > > How in my camel route I call this service in a loop till I receive the final > status in the response JSON ('Active' or 'Failed'). The Loop construct in > camel has a loop count, which is a number . > > > > Also, please note I am using Spring DSL for Camel routes. > > > > Please help . > > > > Cheers, > > Abhijit > -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
