Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Chapter 179. Kestrel Component (deprecated)

Available as of Camel version 2.6

The Kestrel component allows messages to be sent to a Kestrel queue, or messages to be consumed from a Kestrel queue. This component uses the spymemcached client for memcached protocol communication with Kestrel servers.


The kestrel project is inactive and the Camel team regard this components as deprecated.

179.1. URI format


Where queuename is the name of the queue on Kestrel. The addresslist part of the URI may include one or more host:port pairs. For example, to connect to the queue foo on kserver01:22133, use:


If the addresslist is omitted, localhost:22133 is assumed, i.e.:


Likewise, if a port is omitted from a host:port pair in addresslist, the default port 22133 is assumed, i.e.:


Here is an example of a Kestrel endpoint URI used for producing to a clustered queue:


Here is an example of a Kestrel endpoint URI used for consuming concurrently from a queue:


179.2. Options

The Kestrel component supports 2 options which are listed below.


configuration (advanced)

To use a shared configured configuration as base for creating new endpoints.



resolveProperty Placeholders (advanced)

Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.



The Kestrel endpoint is configured using URI syntax:


with the following path and query parameters:

179.2.1. Path Parameters (2 parameters):



The address(es) on which kestrel is running




Required The queue we are polling



179.2.2. Query Parameters (6 parameters):


concurrentConsumers (common)

How many concurrent listeners to schedule for the thread pool



waitTimeMs (common)

How long a given wait should block (server side), in milliseconds



bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.



exceptionHandler (consumer)

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.



exchangePattern (consumer)

Sets the exchange pattern when the consumer creates an exchange.



synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).



179.3. Configuring the Kestrel component using Spring XML

The simplest form of explicit configuration is as follows:

<beans xmlns=""

  <bean id="kestrel" class="org.apache.camel.component.kestrel.KestrelComponent"/>

  <camelContext xmlns="">


That will enable the Kestrel component with all default settings, i.e. it will use localhost:22133, 100ms wait time, and a single non-concurrent consumer by default.

To use specific options in the base configuration (which supplies configuration to endpoints whose ?properties are not specified), you can set up a KestrelConfiguration POJO as follows:

<beans xmlns=""

  <bean id="kestrelConfiguration" class="org.apache.camel.component.kestrel.KestrelConfiguration">
    <property name="addresses" value="kestrel01:22133"/>
    <property name="waitTimeMs" value="100"/>
    <property name="concurrentConsumers" value="1"/>

  <bean id="kestrel" class="org.apache.camel.component.kestrel.KestrelComponent">
    <property name="configuration" ref="kestrelConfiguration"/>

  <camelContext xmlns="">


179.4. Usage Examples

179.4.1. Example 1: Consuming

  .bean("myConsumer", "onMessage");
public class MyConsumer {
    public void onMessage(String message) {

179.4.2. Example 2: Producing

public class MyProducer {
    @EndpointInject(uri = "kestrel://kserver01:22133,kserver02:22133/myqueue")
    ProducerTemplate producerTemplate;

    public void produceSomething() {
        producerTemplate.sendBody("Hello, world.");

179.4.3. Example 3: Spring XML Configuration

  <camelContext xmlns="">
      <from uri="kestrel://ks01:22133/sequential?concurrentConsumers=1&waitTimeMs=500"/>
      <bean ref="myBean" method="onMessage"/>
      <from uri="direct:start"/>
      <to uri="kestrel://ks02:22133/stuff"/>
public class MyBean {
    public void onMessage(String message) {

179.5. Dependencies

The Kestrel component has the following dependencies:

  • spymemcached 2.5 (or greater)

179.5.1. spymemcached

You must have the spymemcached jar on your classpath. Here is a snippet you can use in your pom.xml:


Alternatively, you can download the jar directly.

Warning: Limitations


The spymemcached client library does not work properly with kestrel when JVM assertions are enabled. There is a known issue with spymemcached when assertions are enabled and a requested key contains the /t=…​ extension (i.e. if you’re using the waitTimeMs option on an endpoint URI, which is highly encouraged). Fortunately, JVM assertions are disabled by default, unless you explicitly enable them, so this should not present a problem under normal circumstances. Something to note is that Maven’s Surefire test plugin enables assertions. If you’re using this component in a Maven test environment, you may need to set enableAssertions to false. Please refer to the surefire:test reference for details.

179.6. See Also

  • Configuring Camel
  • Component
  • Endpoint
  • Getting Started