camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmcb55 <mcbenne...@dnb.com>
Subject How to start a polling Timer route for each message received?
Date Wed, 13 Feb 2013 16:41:38 GMT
Hi,

I'm trying to implement a simple, but tricky little route!

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

In pseudo-camel code, I'd push into the following route a message whose body
is just a string that contains the primary Key of the database row
containing the 'safeToContinueFlag' value for that message:

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 should this route be implemented...!?!?



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-start-a-polling-Timer-route-for-each-message-received-tp5727535.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message