camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Using JPA Consumer only once in the Route
Date Wed, 27 Oct 2010 08:41:30 GMT
On Tue, Oct 26, 2010 at 6:04 PM, Ashwin Karpe <akarpe@fusesource.com> wrote:
>
> Hi,
>
> In your particular case the route would look something like the following if
> you adopted the scheduled route policy.
>
> public void configure() {
>      SimpleScheduledRoutePolicy policy = new SimpleScheduledRoutePolicy();
>            long startTime = System.currentTimeMillis() + 3000L;
>            long stopTime =  System.currentTimeMillis() + 9000L;
>            policy.setRouteStartDate(new Date(startTime));
>            policy.setRouteStartRepeatCount(1);
>            policy.setRouteStopDate(new Date(stopTime));
>            policy.setRouteStopRepeatCount(1);
>
>    from(jpa)
>       .routeId("test")
>       .routePolicy(policy)
>       .to(databaseProcessor);
> }
>
> The side benefit of this is that the route can be stopped and restarted as
> many times as you like based on the policy.

I wonder if this would not stop it based on a time? eg looks to me you
got a timespan of 6 seconds between start/stop.


What you should do is to let
- quartz start the route based on the scheduling you want
- stop the route after processing the exchange. Just implement this in
the onExchangeDone method.




>
> Cheers,
>
> Ashwin...
>
> -----
> ---------------------------------------------------------
> Ashwin Karpe
> Apache Camel Committer & Sr Principal Consultant
> FUSESource (a Progress Software Corporation subsidiary)
> http://fusesource.com http://fusesource.com
>
> Blog: http://opensourceknowledge.blogspot.com
> http://opensourceknowledge.blogspot.com
> ---------------------------------------------------------
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-JPA-Consumer-only-once-in-the-Route-tp3237249p3237307.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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

Mime
View raw message