You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rpcat <rp...@gmail.com> on 2013/10/16 19:31:21 UTC

standalone camel stops routing for hour at daylight saving change

My standalone camel app stops routing when I simulate daylight saving time
change by setting the system time back an hour (e.g. date --set "2013-10-16
00:00:30"). Once the system time catches up again to where the time was when
it was set back an hour, the routes all start going again. 

I'm using camel version 2.12 and a camel.main.Main instance to run:  

	public void startDriver() throws Exception
	{
		main = new Main();
		main.enableHangupSupport();	//so you can press ctrl-c to terminate the jvm
		
		//TODO put the config in utilityBean
		UtilityBean utilityBean = new UtilityBean();
		
		// The route has the bean instance.
		main.addRouteBuilder(new Routes(utilityBean));

		// run until you terminate the JVM with <ctrl> c
        log.info("Starting Camel. Use ctrl + c to terminate the JVM.\n");
        main.run();
        
        if(main.isStopping())
        {
            log.info("Camel is stopping for timeMonitor. ");
        }
	}
	
	public static void main(String[] args) throws Exception
	{
		Driver driver = new Driver();
		driver.startDriver();
	}

with a timer route set to repeatCount=1 to start up the initial route.

	    from("timer://startPollingLoop?repeatCount=1")
	    .to("seda:pollingLoop?waitForTaskToComplete=Never");

	    from("seda:pollingLoop")
	    .to("http://localhost:2013/getTime")
		.bean(utilityBean, "setTime1")				
		.delay(60)			// millis delay between polling the timecode, otherwise two
consecutive polls are equal
		.to("http://localhost:2013/getTime")
		.bean(utilityBean, "setTime2")
		.bean(utilityBean, "compareTimecodes");

	@RoutingSlip
	public String compareTimecodes(Exchange exchange)
	{
		String result = "seda:pollingLoop";

		String name = "compareTimecodes";
		log.debug(name + " time1: "+ getTime1() + " time2: " + getTime2() + "\n");
		
		if ((null != getTime1()) && (null != getTime2()) &&
getTime1().contentEquals(getTime2()))
		{
    		result = "direct:restartTimeserver";
		}

		// set the message body to empty string
		exchange.getOut().setBody("");
		
		return result;
	}

If I start the initial route without a timer would that possibly resolve
this? And if so, how do I do that? Clearly, I need the routes to run during
that "extra" hour.

Any help is much appreciated.





--
View this message in context: http://camel.465427.n5.nabble.com/standalone-camel-stops-routing-for-hour-at-daylight-saving-change-tp5741690.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: standalone camel stops routing for hour at daylight saving change

Posted by Claus Ibsen <cl...@gmail.com>.
Camel uses the JDK Timer to trigger, so maybe the daylight saving is
affect it also. Maybe search the web about that.

On Wed, Oct 16, 2013 at 7:31 PM, rpcat <rp...@gmail.com> wrote:
> My standalone camel app stops routing when I simulate daylight saving time
> change by setting the system time back an hour (e.g. date --set "2013-10-16
> 00:00:30"). Once the system time catches up again to where the time was when
> it was set back an hour, the routes all start going again.
>
> I'm using camel version 2.12 and a camel.main.Main instance to run:
>
>         public void startDriver() throws Exception
>         {
>                 main = new Main();
>                 main.enableHangupSupport();     //so you can press ctrl-c to terminate the jvm
>
>                 //TODO put the config in utilityBean
>                 UtilityBean utilityBean = new UtilityBean();
>
>                 // The route has the bean instance.
>                 main.addRouteBuilder(new Routes(utilityBean));
>
>                 // run until you terminate the JVM with <ctrl> c
>         log.info("Starting Camel. Use ctrl + c to terminate the JVM.\n");
>         main.run();
>
>         if(main.isStopping())
>         {
>             log.info("Camel is stopping for timeMonitor. ");
>         }
>         }
>
>         public static void main(String[] args) throws Exception
>         {
>                 Driver driver = new Driver();
>                 driver.startDriver();
>         }
>
> with a timer route set to repeatCount=1 to start up the initial route.
>
>             from("timer://startPollingLoop?repeatCount=1")
>             .to("seda:pollingLoop?waitForTaskToComplete=Never");
>
>             from("seda:pollingLoop")
>             .to("http://localhost:2013/getTime")
>                 .bean(utilityBean, "setTime1")
>                 .delay(60)                      // millis delay between polling the timecode, otherwise two
> consecutive polls are equal
>                 .to("http://localhost:2013/getTime")
>                 .bean(utilityBean, "setTime2")
>                 .bean(utilityBean, "compareTimecodes");
>
>         @RoutingSlip
>         public String compareTimecodes(Exchange exchange)
>         {
>                 String result = "seda:pollingLoop";
>
>                 String name = "compareTimecodes";
>                 log.debug(name + " time1: "+ getTime1() + " time2: " + getTime2() + "\n");
>
>                 if ((null != getTime1()) && (null != getTime2()) &&
> getTime1().contentEquals(getTime2()))
>                 {
>                 result = "direct:restartTimeserver";
>                 }
>
>                 // set the message body to empty string
>                 exchange.getOut().setBody("");
>
>                 return result;
>         }
>
> If I start the initial route without a timer would that possibly resolve
> this? And if so, how do I do that? Clearly, I need the routes to run during
> that "extra" hour.
>
> Any help is much appreciated.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/standalone-camel-stops-routing-for-hour-at-daylight-saving-change-tp5741690.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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