You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Felix Thomas <fe...@gmail.com> on 2015/08/28 14:36:52 UTC
Send Message to a queue before start & end of a route starts prcoessing
Hello,
I have set a Timer componet pointing to a DB, which is triggered at
some interval. I want to send a message to a queue with some value set in
the Header before the processing starts & after its ends .
Like
Message - STARTED
Message - DATA1
Message - DATA2
Message - END
I tried the below approach i don't see any message in the queue
<route customId="false" id="routeMASTER1"
xmlns="http://camel.apache.org/schema/spring">
<from uri="timer://getData?period=2h" />
<process ref="CustomHeaderProcessor" />
<onCompletion mode="BeforeConsumer">
<setHeader headerName="TAG">
<constant>START</constant>
</setHeader>
<to
uri="rabbitmq://Localhost/MSEXCHANGE?autoDelete=false&queue=MS&username=XXXX&password=XXX&routingKey=DAMS"
id="to4" />
</onCompletion>
<onCompletion mode="AfterConsumer">
<setHeader headerName="TAG">
<constant>END</constant>
</setHeader>
<to
uri="rabbitmq://localhost/MSEXCHANGE?autoDelete=false&queue=MS&username=XXXX&password=XXX&routingKey=DAMS"
id="to5" />
</onCompletion>
<setBody id="setBody1">
<constant>select * from TEST</constant>
</setBody>
<to uri="jdbc:DS?outputType=StreamList&statement.maxRows=3"
id="to1" />
..............................
:::::::::::::::::::::::::::::::::::::::::::
Re: Send Message to a queue before start & end of a route starts
prcoessing
Posted by fxthomas <fe...@gmail.com>.
hello,
Thanks for the tip. I could make the logic work using the split variables
since I was using Split .
CamelSplitIndex for start & CamelSplitComplete for the end. Only problem
was that i had to disable threading or else it wont work properly always .
Cheers
--
View this message in context: http://camel.465427.n5.nabble.com/Send-Message-to-a-queue-before-start-end-of-a-route-starts-prcoessing-tp5771056p5771094.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Send Message to a queue before start & end of a route starts prcoessing
Posted by Raul Kripalani <ra...@evosent.com>.
BeforeConsumer means that the logic will be executed before the consumer
finishes, ie. when the route ends and before returning the response to the
caller if InOut and/or before executing the Exchange.done().
To capture the start of the route, you may want to look at interceptFrom.
Regards,
Raúl.
On 28 Aug 2015 14:50, "fxthomas" <fe...@gmail.com> wrote:
> sorry it works , but not the way i want it to be.
>
> the Start message comes in the end of the queue just before the end message
> entry, ideally i thought it would be the first message in the queue , but
> its the second last .
>
> any workarounds ?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Send-Message-to-a-queue-before-start-end-of-a-route-starts-prcoessing-tp5771056p5771061.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Send Message to a queue before start & end of a route starts
prcoessing
Posted by fxthomas <fe...@gmail.com>.
sorry it works , but not the way i want it to be.
the Start message comes in the end of the queue just before the end message
entry, ideally i thought it would be the first message in the queue , but
its the second last .
any workarounds ?
--
View this message in context: http://camel.465427.n5.nabble.com/Send-Message-to-a-queue-before-start-end-of-a-route-starts-prcoessing-tp5771056p5771061.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Send Message to a queue before start & end of a route starts
prcoessing
Posted by fxthomas <fe...@gmail.com>.
Sorry my BAD, I forgot the SetBody Tag in the onCompletion, it works fine now
--
View this message in context: http://camel.465427.n5.nabble.com/Send-Message-to-a-queue-before-start-end-of-a-route-starts-prcoessing-tp5771056p5771060.html
Sent from the Camel - Users mailing list archive at Nabble.com.