camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhijit Kulkarni" <abhijit.kulka...@globalcharge.com>
Subject Loop in Camel - Calling a service till I receive required status back
Date Wed, 13 Nov 2013 17:54:22 GMT
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 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message