Camel provides 2 kind of delayers a) .delay in the EIP (eg you insert .delay somewhere in the route) This will delay when a message reached this point and at this point only.
So if a message arrives at 08:13:57 and you have a delay of 30000 (30 sec) then the message is delayed for 30 sec using Thread.sleep. So that means the message is continued to be routed at 08:14:27 The .delay() has nothing to do when a message arrives or is consumed from a JMS queue or whatever. Its whenever a message arriving to itself the delayer is triggered. b) a delay interceptor that you set in the <camelContext> as an attribute. Its like a global delayer that can be used for development / testing where you want to "slow things down" On Tue, Aug 25, 2009 at 10:32 AM, Charles Moulliard<cmoulli...@gmail.com> wrote: > My idea was not at all to use delay or delayer but quartz or timer. As I > have been confronted to problems with the following route : > > from ( quartz) > . to (activemq:queue:A) > > I have tested the option of delayer/delay which was not the my first choice. > In the meantime, I try pollEnrich (see my last post) about that. > > My question is quite simple : I would like to know if the delay is added for > each message individually ? > ex. I put a message in a queue where we have a delay of 10 minutes, so the > message will be processed by the next endpoint 10 minutes after the post of > the message in the queue. If the message is posted at 8:00, the next > endpoint will process it at 8:10. This description corresponds to the Case B > (described in my previous post) > > Regards, > > Charles Moulliard > Senior Enterprise Architect > Apache Camel Committer > > ***************************** > blog : http://cmoulliard.blogspot.com > > > On Tue, Aug 25, 2009 at 10:24 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > >> On Tue, Aug 25, 2009 at 10:10 AM, Charles Moulliard<cmoulli...@gmail.com> >> wrote: >> > The delay defined in my example is 1 hour (600000) and not 1 minute >> (60000) >> > ;-) >> > >> >> Crazy as you will hold a thread waiting for 1 hour. >> >> > Do you confirm that the correct hypothesis is the case B and not the A ? >> >> I do not understand what you want. >> >> If you want precise timing then use a scheduler such as quartz. >> >> >> > >> > Regards, >> > >> > Charles Moulliard >> > Senior Enterprise Architect >> > Apache Camel Committer >> > >> > ***************************** >> > blog : http://cmoulliard.blogspot.com >> > >> > >> > On Tue, Aug 25, 2009 at 9:55 AM, Claus Ibsen <claus.ib...@gmail.com> >> wrote: >> > >> >> The delay occurs before the next processor, eg in your case .to >> >> >> >> It just delays, eg using 60000 will delay for 1 minute. >> >> >> >> On Tue, Aug 25, 2009 at 9:08 AM, Charles Moulliard<cmoulli...@gmail.com >> > >> >> wrote: >> >> > Quick question. >> >> > >> >> > When delayer or delay are used in route. Is it the process (defined >> after >> >> > the delayer or delay) who will be processed every x seconds/minutes >> >> > (depending on what has been defined) or the messages ? >> >> > >> >> > e.g. >> >> > >> >> > from(queue).delay(600000).to() >> >> > >> >> > Case A : processor is delayed every x seconds/minutes >> >> > >> >> > Route started at 8:00 >> >> > Message posted at 8:15, 8:40 >> >> > Messages will be processed at 9:00 >> >> > >> >> > Case B : message are processed separately >> >> > >> >> > Route started at 8:00 >> >> > Message A : 8:15, >> >> > Message B : 8:40 >> >> > Message A will be processed at 9:15 >> >> > Message B will be processed at 9:40 >> >> > >> >> > Regards >> >> > >> >> > Charles Moulliard >> >> > Senior Enterprise Architect >> >> > Apache Camel Committer >> >> > >> >> > ***************************** >> >> > blog : http://cmoulliard.blogspot.com >> >> > >> >> > >> >> > On Mon, Aug 24, 2009 at 5:29 PM, Claus Ibsen <claus.ib...@gmail.com> >> >> wrote: >> >> > >> >> >> :) >> >> >> >> >> >> A transaction also have a timeout, so you cannot expect that to work >> >> >> as delayer = 2min will delay every single processing step with 2 min. >> >> >> So to route to the end takes like 8 x 2 min. >> >> >> >> >> >> See about Delayer interceptor here: >> >> >> http://camel.apache.org/delay-interceptor.html >> >> >> >> >> >> On Mon, Aug 24, 2009 at 4:48 PM, Charles Moulliard< >> cmoulli...@gmail.com >> >> > >> >> >> wrote: >> >> >> > Hi, >> >> >> > >> >> >> > If a transacted route use delayer, then the process stops (it seems >> >> that >> >> >> the >> >> >> > transaction is not committed ... and that the message stays in the >> >> queue >> >> >> ) >> >> >> > in the step generating the file. >> >> >> > >> >> >> > Here is the syntax of the route : >> >> >> > >> >> >> > <camel:route errorHandlerRef="txErrorHandlerReqNew" >> >> >> > delayer="120000"> >> >> >> > >> >> >> > <camel:from ref="queueReportingEndpoint"/> >> >> >> > <camel:transacted ref="PROPAGATION_REQUIRED_NEW" /> >> >> >> > <camel:choice> >> >> >> > <camel:when> >> >> >> > <camel:simple>${body} != null</camel:simple> >> >> >> > <camel:doTry> >> >> >> > <camel:marshal ref="csvAuditBindyDataFormat" >> /> >> >> >> > <camel:to ref="fileReportingEndpoint" /> // >> >> ROUTE >> >> >> > STOPS HERE >> >> >> > <camel:doCatch> >> >> >> > >> >> >> > <camel:exception>java.lang.Exception</camel:exception> >> >> >> > <camel:to >> >> >> > >> >> >> >> >> >> uri="log:com.xpectis.x3s?level=INFO&multiline=true&showException=true&showCaughtException=true&showStackTrace=true" >> >> >> > /> >> >> >> > <camel:rollback /> >> >> >> > </camel:doCatch> >> >> >> > </camel:doTry> >> >> >> > </camel:when> >> >> >> > </camel:choice> >> >> >> > </camel:route> >> >> >> > >> >> >> > Here is the stack trace of the route when the delayer is not used : >> >> >> > >> >> >> > 16:32:59,651 | INFO | tenerContainer-1 | TraceInterceptor >> >> >> | >> >> >> > rg.apache.camel.processor.Logger 88 | >> >> >> > ID:dell-charles-1840-1251124287338-3:8:1:1:1 >>> >> >> >> > from(queuingservice://x3s:reporting) --> >> ref:PROPAGATION_REQUIRED_NEW, >> >> >> > Pattern:InOnly, Headers:{JMSXGroupID=null, JMSReplyTo=null, >> >> >> > CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv, >> >> JMSPriority=4, >> >> >> > CamelBeanMultiParameterArray=false, >> >> CamelFileNameOnly=OINP_Example.csv, >> >> >> > CamelFileLength=892, CamelFileAbsolute=true, JMSRedelivered=false, >> >> >> > CamelFileParent=d:\temp\data\oinp, CamelFileLastModified=Mon Jul 27 >> >> >> 16:33:12 >> >> >> > CEST 2009, JMSTimestamp=1251124379479, >> >> >> JMSDestination=queue://x3s:reporting, >> >> >> > JMSExpiration=0, CamelFilePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > CamelFileName=OINP_Example.csv, JMSDeliveryMode=2, >> >> JMSCorrelationID=null, >> >> >> > JMSType=null, >> >> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > origin=file, messageType=OINP, >> >> >> > JMSMessageID=ID:dell-charles-1840-1251124287338-3:8:1:1:1}, >> >> >> > BodyType:java.util.ArrayList, >> >> >> > >> >> >> >> >> >> Body:[{com.xpectis.x3s.model.backoffice.audit.in.inaudit=com.xpectis.x3s.model.backoffice.audit.in.inau...@a0ee3f >> >> >> > }] >> >> >> > 16:32:59,651 | INFO | tenerContainer-1 | TraceInterceptor >> >> >> | >> >> >> > rg.apache.camel.processor.Logger 88 | >> >> >> > ID:dell-charles-1840-1251124287338-3:8:1:1:1 >>> >> >> >> > ref:PROPAGATION_REQUIRED_NEW --> Choice, Pattern:InOnly, >> >> >> > Headers:{JMSXGroupID=null, JMSReplyTo=null, >> >> >> > CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv, >> >> JMSPriority=4, >> >> >> > CamelBeanMultiParameterArray=false, >> >> CamelFileNameOnly=OINP_Example.csv, >> >> >> > CamelFileLength=892, CamelFileAbsolute=true, JMSRedelivered=false, >> >> >> > CamelFileParent=d:\temp\data\oinp, CamelFileLastModified=Mon Jul 27 >> >> >> 16:33:12 >> >> >> > CEST 2009, JMSTimestamp=1251124379479, >> >> >> JMSDestination=queue://x3s:reporting, >> >> >> > JMSExpiration=0, CamelFilePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > CamelFileName=OINP_Example.csv, JMSDeliveryMode=2, >> >> JMSCorrelationID=null, >> >> >> > JMSType=null, >> >> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > origin=file, messageType=OINP, >> >> >> > JMSMessageID=ID:dell-charles-1840-1251124287338-3:8:1:1:1}, >> >> >> > BodyType:java.util.ArrayList, >> >> >> > >> >> >> >> >> >> Body:[{com.xpectis.x3s.model.backoffice.audit.in.inaudit=com.xpectis.x3s.model.backoffice.audit.in.inau...@a0ee3f >> >> >> > }] >> >> >> > 16:32:59,682 | INFO | tenerContainer-1 | TraceInterceptor >> >> >> | >> >> >> > rg.apache.camel.processor.Logger 88 | >> >> >> > ID:dell-charles-1840-1251124287338-3:8:1:1:1 >>> Choice --> Try, >> >> >> > Pattern:InOnly, Headers:{JMSXGroupID=null, JMSReplyTo=null, >> >> >> > CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv, >> >> JMSPriority=4, >> >> >> > CamelBeanMultiParameterArray=false, >> >> CamelFileNameOnly=OINP_Example.csv, >> >> >> > CamelFileLength=892, CamelFileAbsolute=true, JMSRedelivered=false, >> >> >> > CamelFileParent=d:\temp\data\oinp, CamelFileLastModified=Mon Jul 27 >> >> >> 16:33:12 >> >> >> > CEST 2009, JMSTimestamp=1251124379479, >> >> >> JMSDestination=queue://x3s:reporting, >> >> >> > JMSExpiration=0, CamelFilePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > CamelFileName=OINP_Example.csv, JMSDeliveryMode=2, >> >> JMSCorrelationID=null, >> >> >> > JMSType=null, >> >> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > origin=file, messageType=OINP, >> >> >> > JMSMessageID=ID:dell-charles-1840-1251124287338-3:8:1:1:1}, >> >> >> > BodyType:java.util.ArrayList, >> >> >> > >> >> >> >> >> >> Body:[{com.xpectis.x3s.model.backoffice.audit.in.inaudit=com.xpectis.x3s.model.backoffice.audit.in.inau...@a0ee3f >> >> >> > }] >> >> >> > 16:32:59,698 | INFO | tenerContainer-1 | TraceInterceptor >> >> >> | >> >> >> > rg.apache.camel.processor.Logger 88 | >> >> >> > ID:dell-charles-1840-1251124287338-3:8:1:1:1 >>> Try -->, >> >> Pattern:InOnly, >> >> >> > Headers:{JMSXGroupID=null, JMSReplyTo=null, >> >> >> > CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv, >> >> JMSPriority=4, >> >> >> > CamelBeanMultiParameterArray=false, >> >> CamelFileNameOnly=OINP_Example.csv, >> >> >> > CamelFileLength=892, CamelFileAbsolute=true, JMSRedelivered=false, >> >> >> > CamelFileParent=d:\temp\data\oinp, CamelFileLastModified=Mon Jul 27 >> >> >> 16:33:12 >> >> >> > CEST 2009, JMSTimestamp=1251124379479, >> >> >> JMSDestination=queue://x3s:reporting, >> >> >> > JMSExpiration=0, CamelFilePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > CamelFileName=OINP_Example.csv, JMSDeliveryMode=2, >> >> JMSCorrelationID=null, >> >> >> > JMSType=null, >> >> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > origin=file, messageType=OINP, >> >> >> > JMSMessageID=ID:dell-charles-1840-1251124287338-3:8:1:1:1}, >> >> >> > BodyType:java.util.ArrayList, >> >> >> > >> >> >> >> >> >> Body:[{com.xpectis.x3s.model.backoffice.audit.in.inaudit=com.xpectis.x3s.model.backoffice.audit.in.inau...@a0ee3f >> >> >> > }] >> >> >> > 16:33:00,151 | INFO | tenerContainer-1 | TraceInterceptor >> >> >> | >> >> >> > rg.apache.camel.processor.Logger 88 | >> >> >> > ID:dell-charles-1840-1251124287338-3:8:1:1:1 >>> --> >> >> >> > >> >> >> >> >> >> file://d:/temp/data/reporting?fileName=%2F%24%7Bdate%3Anow%3AyyyyMMdd%7D%2F%24%7Bdate%3Anow%3Ahhmmss%7D.txt, >> >> >> > Pattern:InOnly, >> >> >> > Headers:{JMSMessageID=ID:dell-charles-1840-1251124287338-3:8:1:1:1, >> >> >> > JMSReplyTo=null, CamelFileName=OINP_Example.csv, >> >> >> JMSTimestamp=1251124379479, >> >> >> > JMSCorrelationID=null, CamelFileParent=d:\temp\data\oinp, >> >> JMSPriority=4, >> >> >> > CamelFileNameOnly=OINP_Example.csv, >> >> JMSDestination=queue://x3s:reporting, >> >> >> > origin=file, JMSExpiration=0, >> >> >> > CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> JMSDeliveryMode=2, >> >> >> > CamelFileLength=892, CamelBeanMultiParameterArray=false, >> >> >> > JMSRedelivered=false, JMSXGroupID=null, JMSType=null, >> >> >> > CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> messageType=OINP, >> >> >> > CamelFileAbsolute=true, >> >> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > CamelFileLastModified=Mon Jul 27 16:33:12 CEST 2009}, >> BodyType:byte[], >> >> >> > Body:E9998,Unknown error,ERR,20093224-04:32:59,null,null,null >> >> >> > >> >> >> > But when DELAYER is enable in the route, the transaction is not >> >> commited >> >> >> : >> >> >> > >> >> >> > 16:46:37,073 | INFO | tenerContainer-1 | TraceInterceptor >> >> >> | >> >> >> > rg.apache.camel.processor.Logger 88 | >> >> >> > ID:dell-charles-1840-1251124287338-3:17:1:1:1 >>> Choice --> Try, >> >> >> > Pattern:InOnly, Headers:{CamelFileNameOnly=OINP_Example.csv, >> >> >> > JMSDestination=queue://x3s:reporting, >> >> >> > CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > CamelFileName=OINP_Example.csv, origin=file, JMSPriority=4, >> >> >> > JMSXGroupID=null, JMSReplyTo=null, >> >> >> > CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > CamelBeanMultiParameterArray=false, JMSRedelivered=false, >> >> >> JMSDeliveryMode=2, >> >> >> > JMSMessageID=ID:dell-charles-1840-1251124287338-3:17:1:1:1, >> >> >> > CamelFileParent=d:\temp\data\oinp, JMSType=null, JMSExpiration=0, >> >> >> > CamelFileLength=892, CamelFileLastModified=Mon Jul 27 16:33:12 CEST >> >> 2009, >> >> >> > CamelFileAbsolute=true, JMSCorrelationID=null, messageType=OINP, >> >> >> > CamelFilePath=d:\temp\data\oinp\OINP_Example.csv, >> >> >> > JMSTimestamp=1251124681885}, BodyType:java.util.ArrayList, >> >> >> > >> >> >> >> >> >> Body:[{com.xpectis.x3s.model.backoffice.audit.in.inaudit=com.xpectis.x3s.model.backoffice.audit.in.inau...@13e6f3 >> >> >> > }] >> >> >> > >> >> >> > Every 2 minutes, the delayer tries to reprocess the message without >> >> >> success >> >> >> > >> >> >> > Regards, >> >> >> > >> >> >> > >> >> >> > Charles Moulliard >> >> >> > Senior Enterprise Architect >> >> >> > Apache Camel Committer >> >> >> > >> >> >> > ***************************** >> >> >> > blog : http://cmoulliard.blogspot.com >> >> >> > >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> Claus Ibsen >> >> >> Apache Camel Committer >> >> >> >> >> >> Open Source Integration: http://fusesource.com >> >> >> Blog: http://davsclaus.blogspot.com/ >> >> >> Twitter: http://twitter.com/davsclaus >> >> >> >> >> > >> >> >> >> >> >> >> >> -- >> >> Claus Ibsen >> >> Apache Camel Committer >> >> >> >> Open Source Integration: http://fusesource.com >> >> Blog: http://davsclaus.blogspot.com/ >> >> Twitter: http://twitter.com/davsclaus >> >> >> > >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus