Delayer - 6.3

Talend ESB Mediation Developer Guide

Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Design and Development
Talend ESB

The Delayer Pattern allows you to delay the delivery of messages to some destination. Note: the specified expression is a value in milliseconds to wait from the current time, so if you want to wait 3 sec from now, the expression should be 3000. You can also use a long value for a fixed value to indicate the delay in milliseconds. See the Spring DSL samples below for Delayer.


Default Value


asyncDelayedfalseIf enabled then delayed messages happens asynchronously using a scheduled thread pool.
executorServiceRef Refers to a custom Thread Pool to be used if asyncDelay has been enabled.
callerRunsWhenRejectedtrueIs used if asyncDelayed was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task.

Using the Fluent Builders

The example below will delay all messages received on seda:b 1 second before sending them to mock:result.


You can just delay things a fixed amount of time from the point at which the delayer receives the message. For example to delay things 2 seconds.


The above assume that the delivery order is maintained and that the messages are delivered in delay order. If you want to reorder the messages based on delivery time, you can use the Resequencer with this pattern. For example:


You can of course use many different Expression languages such as XPath, XQuery, SQL or various Scripting Languages. For example to delay the message for the time period specified in the header, use the following syntax:


And to delay processing using the Simple language you can use the following DSL:


Spring DSL

The sample below demonstrates the delay in Spring DSL:

<camelContext xmlns="">
        <from uri="seda:a"/>
        <to uri="mock:result"/>
        <from uri="seda:b"/>
        <to uri="mock:result"/>

Asynchronous delaying

You can let the Delayer use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages etc.

From Java DSL

You use the asyncDelayed() to enable the async behavior.


From Spring XML

You use the asyncDelayed="true" attribute to enable the async behavior.

   <from uri="activemq:queue:foo"/>
   <delay asyncDelayed="true">
   <to uri="activemq:aDealyedQueue"/>

Creating a custom delay

You can use an expression to determine when to send a message using something like this

  delay().method("someBean", "computeDelay").

then the bean would look like this:

public class SomeBean {
  public long computeDelay() { 
     long delay = 0;
     // use Java code to compute a delay value in milliseconds
     return delay;