For each message that arrives on a queue, I want to kick-off a polling timer
to periodically check a specific database row *for that message*, checking
for a 'safeToContinue' flag changing value from 'false' to 'true'. Once the
corresponding flag in the database for that message (i.e. the message body
contains the Primary Key of it's database row) changes to 'true' I want to
stop that message's polling job, and progress it's processing to the next
stage of my pipeline.

Obviously the following Camel code won't work (you can't use a 'timer'
component in a 'to()' call), but hopefully it illustrates what I'm trying to
achieve:

from("direct://messagesWithDatabasePrimaryKeyValueInBody")
  .to("timer://foo?period=60000")
  .setBody(constant("select safeToContinueFlag from tableX where primaryKey
= ") + constant(getIn().getBody()))
  .to("jdbc://testDB")
  .choice()
    .when(body().isEqualTo("true"))
      .to(KILL THE POLLING TIMER JOB FOR THIS MESSAGE)
      .to("direct://nextPhaseOfMyPipeline");
    .otherwise()
      // Continue polling until database flag changes to 'true'...
  .end();

How would you implement this simple use-case...!?!?



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-would-you-implement-this-simple-but-tricky-little-route-tp5727651.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to