James.Strachan wrote:
> 
> 2008/5/9 Krystian Szczesny <[EMAIL PROTECTED]>:
>>
>>  Hi,
>>
>>
>>  Before, when delaying single messages I've used for example
>> delayer(3000)
>>  and it worked flawlessly.
>>  Now I need to delay a sequence of messages, so when I send 5 messages,
>> the
>>  first should be delayed by 3000, second by 6000 etc...
>>
>>  Is there any way I could do that with Camel?
> 
> You just need to use an expression for the time that the message is to
> be sent at. So you could do something like...
> 
> from("activemq:foo").delay().method("someBean",
> "sendAtTime").to("activemq:bar");
> 
> then the bean would look like this...
> 
> public class SomeBean {
>   public long sendAtTime(@Header("MyDelayHeader") long delay) {
>     if (delay <= 0) delay = 3000;
>     return System.currentTimeMillis() + delay;
>  }
> }
> 
> which would look for the MyDelayHeader on the message and use that as the
> delay.
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 
Hi James,

thanks for fast answer.
One more thing if you could...
I am using spring to configure the whole thing:

        <camelContext id="camel"
                xmlns="http://activemq.apache.org/camel/schema/spring";>
                <route>
                        <from uri="activemq:queue:Input" />
                        <delayer>
                                <simple>header.JMSTimestamp</simple>
                                <to uri="activemq:queue:Delayed" />
                                <delay>3000</delay>
                        </delayer>
                </route>
        </camelContext>

How can I add "method("someBean","sendAtTime")" to this configuration?
I would be grateful for an answer.

Best regards,
Krystian
-- 
View this message in context: 
http://www.nabble.com/Delay-messages-with-camel-sequentially-tp17144701s22882p17145140.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to