camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reuben Garrett <reubengarr...@gmail.com>
Subject Re: Multiple timers with same name in same context
Date Wed, 22 Feb 2012 15:40:22 GMT
I have a similar scenario in which I use a single timer endpoint that
<multicast/>s to different vm: or seda: queues containing the "real"
consumers.  Could that be a good work-around in the interim?

~ RNPG

On Wed, Feb 22, 2012 at 07:46, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> Hi
>
> If the uri is slightly different then that ought to work, eg such as
> different delay etc.
> But I guess the endpoint should support multiple consumers by default.
>
> Could you log a JIRA.
>
>
> On Wed, Feb 22, 2012 at 2:40 PM, Preben.Asmussen <pras@dr.dk> wrote:
> > 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.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message