Name

When — Triggers a route when an expression evaluates to true

Usage

The When pattern is part of a content based router. It is used to determine if a path is to be followed by the message. The message is evaluated against the specified expression and if it evaluates to true the path is followed.

The When pattern must follow one of these patterns:

  • Choice

  • Intercept

  • Intercept Send To Endpoint

The When pattern can also be used with these patterns:

  • On Completion

  • On Exception

Properties

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

Table 30. When Properties

NameDescription
ExpressionSpecifies the expression used to determine if this path should be taken.
languageSpecifies the expression language used to process the expression.
Inherit Error HandlerSpecifies whether the node should use the error handler configured for the route. The default is Disabled.
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.

Related topics

Intercept
Intercept Send To Endpoint
Expression and Predicates Languages
Configuring the route editor