camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Preben.Asmussen" <p...@dr.dk>
Subject Multiple timers with same name in same context
Date Wed, 22 Feb 2012 13:40:33 GMT
Hi

You should be to create multiple timers wit the same name in a Context.
According to http://camel.apache.org/timer.html if you create a timer with
the same name it will only create one Timer object that will be shared
across endpoints.

so this should be legal:
<camelContext id="myContext" xmlns="http://camel.apache.org/schema/spring">
		<route id="route1">
			<from uri="timer:myname?fixedRate=true&amp;period=30000&amp;delay=30000"
/>		
			<to uri="mock:publish"/>
		</route>
		
		<route id="route2">
			<from uri="timer:myname?fixedRate=true&amp;period=30000&amp;delay=30000"
/>
			<to uri="mock:publish2"/>
		</route>
.....

But i get an error :

org.apache.camel.FailedToStartRouteException: Failed to start route route2
because of Multiple consumers for the same endpoint is not allowed:
Endpoint[timer:myname?delay=30000&fixedRate=true&period=30000]
	at
org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1926)
	at
org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1902)
	at
org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1830)
	at
org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1614)
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1504)
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1391)
	at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:181)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1359)
	at
org.apache.camel.test.junit4.CamelTestSupport.startCamelContext(CamelTestSupport.java:410)
	at
org.apache.camel.test.junit4.CamelTestSupport.doSetUp(CamelTestSupport.java:277)
	at
org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:204)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
	at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


cheers
Preben

--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-timers-with-same-name-in-same-context-tp5505128p5505128.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message