Hi, can anyone help with this.. specifically computeDelay() method never appears to be called..
<camel:delay> <camel:method ref="retryDelayCompute" method="computeDelay"/> <camel:to ref="endpoint-submit-in" /> <camel:log message="Routing to in queue..." /> </camel:delay> We are using camel 2.7.1 and found this post which suggests that the above config should work.. http://camel.465427.n5.nabble.com/Delayer-and-asyncDelayed-how-to-delay-asynchronously-td3252456.html It seems to work ok using the java DSL eg from(...).delay().method(instance, "method").to(..) Thanks, Tom On Tue, Jan 24, 2012 at 3:42 PM, Mike Spelling <mike_spell...@hotmail.com>wrote: > > > > > > > > > > I'm using Camel v2.7.1 and trying to configure a route to apply a delay to > incoming messages before passing them on to another queue. I've read about > a similar problem at > http://osdir.com/ml/users-camel-apache/2010-11/msg00134.html but the > answer did not seem to work for me. > I don't think I can use a <camel:constant> in the <camel:delay> block as > this would block incoming messages, making new messages have to wait for > any previous messages to be routed before having another delay applied. The > attribute asyncDelayed="true" in the <camel:delay> block appeared to use a > thread per message to ensure the correct delay was applied which will > quickly use up the maxConcurrentConsumers. > I therefore wanted to pass the delay block a custom method to calculate > for correct delay from the JMSHeader Timestamp. > > > > > > > > > My Camel configuration contains: > <?xml version="1.0" encoding="UTF-8"?> > > <beans xmlns="http://www.springframework.org/schema/beans" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xmlns:camel="http://camel.apache.org/schema/spring" > > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring-2.0-M1.xsd"> > > > > <bean id="RetryDelayCompute" class="myPackage.RetryDelayCompute" /> > > > > <camel:camelContext autoStartup="true"> > > > > <camel:endpoint id="endpoint-submit-in" > uri="activemq:l2vc.pending?transacted=true" /> > > <camel:endpoint id="endpoint-submit-retrywait" > uri="activemq:l2vc.retrywait" /> > > > > <camel:route autoStartup="true" errorHandlerRef="pending.error"> > <camel:from ref="endpoint-submit-retrywait" /> > <camel:log message="Routing from retrywait queue..." /> > > <camel:delay> > > <camel:method ref="RetryDelayCompute" method="computeDelay"/> > > <camel:to ref="endpoint-submit-in" /> > <camel:log message="Routing to in queue..." /> > > </camel:delay> > > </camel:route> > > > > </camel:camelContext> > > </beans> > My bean is below: > > > package myPackage; > @Componentpublic class RetryDelayCompute { final > static long TOTAL_DELAY_ON_QUEUE = 11000; public long > computeDelay(@Header("JMSTimestamp") long jmsTimestamp) { > System.out.println("Calculating delay..."); long now = > System.currentTimeMillis(); long timeOnQueue = now - jmsTimestamp; > return TOTAL_DELAY_ON_QUEUE - timeOnQueue; }} > On running tests the method is never called. Although the component is > instantiated the logs show that the method never runs. Messages are simply > routed to the correct queue with no delay. > Any help appreciated! > Thanks, > Mike