Resequence — Resequences messages based on an expression
The Resequence pattern reorders messages according to a specified expression. It can be used in one of two modes:
batch—the resequencer collects the messages into a batch, resequences them and sends the batch to the target endpoint
stream—the resequencer looks for gaps in the message stream and resequences the messages between the gaps before sending them to the target endpoint
The Resequence pattern can be placed anywhere in the body of a route. It can only support a single output.
Table 24 describes the properties you can specify using the properties editor.
Table 24. Resequence Properties
Name | Description |
---|---|
Inherit Error Handler | Specifies whether the node should use the error handler configured for the route.
The default is Disabled . |
Expression | Specifies the expression used to resequence the messages. |
language | Specifies the expression language used to process the expression. |
Resequencer Config |
Specifies the configuration for the resequencer:
Configure only one mode. |
Id | Specifies a unique identifier for the endpoint. The Id can be used to refer to the endpoint in the Camel XML file. |
Description | Specifies 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. |
Table 25, “batch-config Properties” describes the properties you can specify using the properties editor.
Table 25. batch-config Properties
Name | Description |
---|---|
Batch Size | Specifies the number of messages to include in the batch. The default is
100 . |
Batch Timeout | Specifies the amount of time, in milliseconds, the node will attempt to batch up
the messages before timing out. The default is 1000 . |
Ignore Invalid Exchanges | Specifies whether the resequencer ignores invalid exchanges, those for which it
cannot evaluate the specified expression. The default is
Disabled , which results in the resequencer throwing a
CamelExchangeException when it encounters an invalid exchange. |
Table 26, “stream-config Properties” describes the properties you can specify using the properties editor.
Table 26. stream-config Properties
Name | Description |
---|---|
Capacity | Specifies the maximum number of messages that can be stored in the node's memory while it waits to receive out-of-sequence messages. This property is used to prevent the node from running out of memory when it
detects gaps in the message stream. In general, when using a large timeout value,
set the capacity value sufficiently high to accommodate it (for example,
The default is |
Ignore Invalid Exchanges | Specifies whether the resequencer ignores invalid exchanges, those for which it
cannot evaluate the specified expression. The default is
Disabled , which results in the resequencer throwing a
CamelExchangeException when it encounters an invalid exchange. |
Timeout | Specifies the amount of time, in milliseconds, the node will wait to receive an out-of-sequence message before timing out. If you know the max time difference between successive messages in the stream, set the timeout to that value. Doing so guarantees that all messages in the stream will be delivered in the correct order to the next node in the route. The lower the timeout value compared to the out-of-sequence time difference, the greater the probability of out-of-sequence message delivery. The default is |