I would not recommend to hold a camel route processing for a longer time
to wait for the db flag.
So I when the message comes in I would check the DB if the flag is set.
If yes I would proceed. If not I would store the message in a DB or
filesystem.
In another route I would poll the DB for the flag (e.g with camel-jpa).
When the DB change comes in I would check if the message is in the store
above. If yes I would do the processing.
So you have the effect of only processing the message when the flag is
set and at the same time no blocked threads.
Christian
On 15.02.2013 15:34, pmcb55 wrote:
> 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.
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com