You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles Moulliard <cm...@gmail.com> on 2011/04/27 13:16:48 UTC

Trigger start/stop/resume/suspend of a camel route using queue, db

Hi,

Can we extend the RoutePolicy class in Camel to trigger
start/stop/resume/suspend camel route based on an Action which is not based
on events coming from Quartz Jobs but by example messages/events published
in a queue, db, ...
If this is possible, does it mean that the class who will extend the
RoutePolicy must be created into the corresponding camel-component
(camel-jms for messages in queue, camel-jdbc or sql or jpa for messages in a
DB, ....) ?

Regards,

Charles

--
View this message in context: http://camel.465427.n5.nabble.com/Trigger-start-stop-resume-suspend-of-a-camel-route-using-queue-db-tp4343283p4343283.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Trigger start/stop/resume/suspend of a camel route using queue, db

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Oct 25, 2012 at 4:06 PM, rajasekar <ex...@nokia.com> wrote:
> Hi ,
>
> Can you provide me some sample of camel context which uses suspend and
> resume route .
>
> I have requirement to suspend a route ( in a camel-context.xml ) when n
> number errors occurred calling a http endpoint and stop consuming messages
> from jms queue for x time and resume this route to start consuming messages
> from jms queue and send it to http endpoint.
>

See this page
http://camel.apache.org/routepolicy

You can then add logic in onExchangeDone and check for failure, and
then react accordingly.
To suspend/stop a route see the next FAQ

See this FAQ
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

An alternative is to use an event notifier to listen on events, and
then react accordingly.
http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html

Then you can listen for exchanges failed, and coming from a given
route/endpoint as origin. To know it was from the route you want to
suspend if X number of errors etc.

There is API on CamelContext to control routes, to suspend/stop/start etc.



> Regards
> Raj
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Trigger-start-stop-resume-suspend-of-a-camel-route-using-queue-db-tp4343283p5721560.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Trigger start/stop/resume/suspend of a camel route using queue, db

Posted by rajasekar <ex...@nokia.com>.
Hi ,

Can you provide me some sample of camel context which uses suspend and
resume route . 

I have requirement to suspend a route ( in a camel-context.xml ) when n
number errors occurred calling a http endpoint and stop consuming messages
from jms queue for x time and resume this route to start consuming messages
from jms queue and send it to http endpoint.

Regards
Raj



--
View this message in context: http://camel.465427.n5.nabble.com/Trigger-start-stop-resume-suspend-of-a-camel-route-using-queue-db-tp4343283p5721560.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Trigger start/stop/resume/suspend of a camel route using queue, db

Posted by Claus Ibsen <cl...@gmail.com>.
Yes thats possible.

I suggest to build  custom policy and include that in your Camel application.

Of course there may be some OSGi imports you need because the custom
policy need to use JDBC or whatever to integrate with the DB.



On Wed, Apr 27, 2011 at 1:16 PM, Charles Moulliard <cm...@gmail.com> wrote:
> Hi,
>
> Can we extend the RoutePolicy class in Camel to trigger
> start/stop/resume/suspend camel route based on an Action which is not based
> on events coming from Quartz Jobs but by example messages/events published
> in a queue, db, ...
> If this is possible, does it mean that the class who will extend the
> RoutePolicy must be created into the corresponding camel-component
> (camel-jms for messages in queue, camel-jdbc or sql or jpa for messages in a
> DB, ....) ?
>
> Regards,
>
> Charles
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Trigger-start-stop-resume-suspend-of-a-camel-route-using-queue-db-tp4343283p4343283.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/