Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

...

The expression is a value in millis to wait from the current time, so the expression should just be 3000.
However you can use a long value for a fixed value to indicate the delay in millis.
See the Spring DSL samples for Delayer.

...

...

See this ticket: https://issues.apache.org/jira/browse/CAMEL-2654

...

Name

Default Value

Description

asyncDelayed

false

Camel

...

2.4:

...

If

...

enabled

...

then

...

delayed

...

messages

...

happens

...

asynchronously

...

using

...

a

...

scheduled

...

thread

...

pool.

...

executorServiceRef

 

Camel 2.4:

...

Refers

...

to

...

a

...

custom

...

...

...

to

...

be

...

used

...

if

...

asyncDelay

...

has

...

been

...

enabled.

...

callerRunsWhenRejected

true

Camel 2.4:

...

Is

...

used

...

if

...

asyncDelayed

...

was

...

enabled.

...

This

...

controls

...

if

...

the

...

caller

...

thread

...

should

...

execute

...

the

...

task

...

if

...

the

...

thread

...

pool

...

rejected

...

the

...

task.

...

...

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:

...

For further examples of this pattern in use you could look at the junit test case

...

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

...

From Spring XML

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

...

...

Creating a custom delay

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

...

...

then the bean would look like this...

...

...

Include PageUsing This PatternUsing This Pattern

See Also