Route Processors (Technical Guide)

To enable the router to do something more interesting than simply connecting a consumer endpoint to a producer endpoint, you can add processors to your route. A processor is a command you can insert into a routing rule to perform arbitrary processing of messages that flow through the rule.

Processor

Definition

Processor

Definition

aggregate

Creates an aggregator, which combines multiple incoming exchanges into a single exchange.

aop

Will use Aspect Oriented Programming (AOP) to do work before and after a specified sub-route

bean

Process the current exchange by invoking a method on a Java object (or bean)

choice

Selects a particular sub-route based on the exchange content, using when and otherwise clauses.

convertBodyTo

Converts the IN message to the specified type

delay

Delays the propagation of the exchange to the latter part of the route.

doTry

Creates a try/catch block for handling exceptions, using doCatch, doFinally, and end clauses.

enrich

Will combine the current exchange with data requested from a specified producer endpoint URI.

filter

Uses a predicate expression to filter incoming exchanges.

inOnly

This can either set the current exchange’s MEP to InOnly (if no arguments provided) or sends the exchange as an InOnly to the specified endpoint(s).

inOut

Either sets the current exchange’s MEP to InOut (if no arguments provided) or sends the exchange as an InOut to the specified endpoint(s).

loadBalance

Implements a load balancing process over a set of endpoints

log

Will log an error message to the console

loop

Repeatedly resends each exchange to the latter part of the route.

marshal

In preparation for sending over a particular transport protocol, it performs a transformation into a low-level or binary format using the specified data format.

multicast

Multicasts the current exchange to multiple destinations, where each destination gets its own copy of the exchange.

onCompletion

Defines a sub-route that gets executed after the main route has completed

onException

Defines a sub-route that gets executed whenever the specified exception occurs.

pipeline

Sends the exchange to a set of endpoints, where the output of one endpoint becomes the input of the next.

pollEnrich

Combines the current exchange with data that has been polled from a consumer endpoint URI.

process

Will execute a custom processor on the current exchange.

recipientList

Sends the exchange to a list of recipients that is calculated at runtime

removeHeader

Removes the specified header from the exchange’s IN message.

removeHeaders

Will remove the headers matching a specified pattern from the exchange’s IN message. This pattern can have the form “prefix\*”. In that situation, it matches every name starting with prefix.

removeProperty

Removes the specified exchange property from the exchange.

removeProperties

This will remove the properties matching the specified pattern from the exchange. It will accept a comma separated list of 1 or more strings as arguments.

resequence

Re-orders incoming exchanges on the basis of a specified comparator operation. It supports modes of either batch or stream mode.

rollback

Marks the current transaction for rollback onl

routingSlip

Will route the exchange through a dynamically constructed pipeline based on the list of endpoint URIs extracted from a slip header.

sample

This will create a sampling throttle that will allow us to extract a sample of exchanges from the traffic on a route.

setBody

Sets the message body of the exchange’s IN message.

setExchangePattern

Sets the current exchange’s MEP to the specified value

setHeader

Sets the specified header in the exchange’s IN message.

setOutHeader

Sets the specified header in the exchange’s Out message.

setProperty

Sets the specified exchange property

sort

Will sort the contents of the IN message body

split

Splits the current exchange into a sequence of exchanges, whereby each split exchange willcontain only a fragment of the original message body.

stop

Stops routing the current exchange and marks it as completed.

threads

Creates a thread pool for concurrent processing of the latter part of the route.

throttle

Limit the flow rate to the specified level, generally defined as exchanges per second.

throwException

Throw the specified exception

to

Send the exchange to one or more endpoints

transform

Will copy the IN message headers to the OUT message headers and also set the OUT message body to the specified value.

unmarshal

Transforms the IN message body from a low-level or binary format to a high-level format, using the specified data format.

validate

It utilizes a predicate expression to test the validity of current message. If predicate returns false, throws a PredicateValidationException exception.

wireTap

Will send a copy of the current exchange to the specified wire tap URI, using the ExchangePattern.InOnly MEP.