I don’t have example code readily available, but one possible approach would be:
- Send job request REST/JSON and get job ID back
- Add ID to a queue of not-yet-done jobs
- A separate route pulls job IDs from the not-done queue and polls
- If not done, put it back on the queue
- If done, put ID on a different queue for done jobs
- A third route pulls job IDs from the done queue and retrieves the search
You’d want some delay or use a timer in combination with the not-done job queue.
> On Aug 8, 2017, at 4:12 AM, simon_dietschi <simon.diets...@siemens.com> wrote:
> Hi Camel folks,
> I am currently looking for a simple approach achieving the following in
> Apache Camel / Spring Boot:
> 1. Send a search job request to an external REST/JSON API
> 2. Get a search processing job ID from the API
> 3. Poll the API until it returns a JSON response containing a specific
> status = done
> 4. Once status done has been returned, proceed with the retrieval of the
> search result (separate part, considered to be straight forward)
> The first solution one may think of is to implement the Polling Consumer
> pattern, which in my opinion requires too much overhead code (need to
> implement Component, Endpoint, Consumer,...) and more important this pattern
> does the contrary - it returns a message once a message is available (e.g.
> Another approach would be a simple Processor where I loop a defined number
> of times calling the API or using the DSL -> doWhile...
> As I was unable to find a good code snippet, it would be cool if you guys
> can share your thoughts or point me to a good sample.
> View this message in context:
> Sent from the Camel - Users mailing list archive at Nabble.com.