camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Babak Vahdat <babak.vah...@swissonline.ch>
Subject Re: Global Route Policy?
Date Tue, 15 May 2012 20:16:01 GMT
Using one of the Camel's own unit-tests [1] I did modify the test as the
following to reproduce the behavior you've, however without success, as the
test does pass:

        final SimpleScheduledRoutePolicy policy = new
SimpleScheduledRoutePolicy();
        long startTime = System.currentTimeMillis() + 3000L;
        long stopTime = System.currentTimeMillis() + 8000L;
        policy.setRouteStartDate(new Date(startTime));
        policy.setRouteStartRepeatCount(1);
        policy.setRouteStartRepeatInterval(3000);
        policy.setRouteStopDate(new Date(stopTime));
        policy.setRouteStopRepeatCount(1);
        policy.setRouteStopRepeatInterval(3000);

        context.getComponent("quartz",
QuartzComponent.class).setPropertiesFile("org/apache/camel/routepolicy/quartz/myquartz.properties");
        context.addRoutes(new RouteBuilder() {
            public void configure() {   
                
                from("direct:start").noAutoStartup()
                    .routeId("test")
                    .routePolicy(policy)
                    .to("mock:success");
            }
        });
        
        context.addRoutes(new RouteBuilder() {
            public void configure() {   
                
                from("direct:start2").noAutoStartup()
                    .routeId("test2")
                    .routePolicy(policy)
                    .to("mock:success2");
            }
        });

        context.start();
        
        Thread.sleep(5000);

        assertTrue(context.getRouteStatus("test") == ServiceStatus.Started);        
        assertTrue(context.getRouteStatus("test2") ==
ServiceStatus.Started);

As you see using the same route polic both routes do start successfully,
however it's not in Spring DSL as in your case but in Java, but this should
not make any difference.

Can you also double check [2] to see if that documentation could help you
any further?

[1]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SimpleScheduledCombinedRoutePolicyTest.java
[2]
http://fusesource.com/docs/router/2.5/eip/BasicPrinciples-ScheduledRoute-Simple.html

Babak

--
View this message in context: http://camel.465427.n5.nabble.com/Global-Route-Policy-tp5710327p5710373.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message