Name

Threads — Specifies that all steps after this node are processed asynchronously

Usage

The Threads pattern specifies that the nodes after it in the route are processed asynchronously. This means that the route can use multiple threads to process messages and that the client will not wait for a reply.

The Threads pattern can be used anywhere in the body of a route.

Properties

Table 103 describes the properties you can specify using the properties editor.

Table 103. Threads Properties

NameDescription
Time UnitSpecifies the unit of measure for timeout values.
Inherit Error HandlerSpecifies whether the node should use the error handler configured for the route. The default is Disabled.
Pool SizeSpecifies the core pool size for the thread pool.
Max Pool SizeSpecifies the maximum pool size for the thread pool.
Max Queue SizeSpecifies the maximum size of the thread queue.
Thread NameSpecifies an expression, in the simple language, that is used to generate unique names for the threads used to process messages.
Executor Service RefSpecifies a reference for looking up the executorService to use for thread pool management.
Keep Alive TimeSpecifies the amount of time a thread can be idle before it is reaped.
Caller Runs When RejectedSpecifies whether tasks rejected by the thread pool are executed by the calling thread. The default is Disabled.
Rejected Policy

Specifies how tasks rejected by the thread pool are handled. Valid values are:

  • Abort—the handler throws a runtime RejectedExecutionException upon rejection.

  • CallerRuns—the thread that invokes execute itself runs the task.

  • DiscardOldest—the task at the head of the work queue is dropped, and then execution is retried.

  • Discard—the task that cannot be executed is dropped.

IdSpecifies a unique identifier for the endpoint. The Id can be used to refer to the endpoint in the Camel XML file.
DescriptionSpecifies a text description for the node. This description is included in the generated XML file, but it is informational only. It is not used by Apache Camel.