---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: kestrel
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: kestrel
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: kestrel
        spec:
          containers:
          - image: funktion/connector-kestrel:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: kestrel
      syntax: kestrel:addresses/queue
      title: Kestrel
      description: The kestrel component allows messages to be sent to (or consumed from) Kestrel brokers.
      label: messaging
      deprecated: true
      async: false
      javaType: org.apache.camel.component.kestrel.KestrelComponent
      groupId: org.apache.camel
      artifactId: camel-kestrel
      version: 2.18.3
    componentProperties:
      configuration:
        kind: property
        type: object
        javaType: org.apache.camel.component.kestrel.KestrelConfiguration
        deprecated: false
        secret: false
        description: To use a shared configured configuration as base for creating new endpoints.
        order: 0
    properties:
      addresses:
        kind: path
        group: common
        type: array
        javaType: java.lang.String[]
        deprecated: false
        secret: false
        defaultValue: localhost:22133
        description: The address(es) on which kestrel is running
        order: 0
      queue:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The queue we are polling
        order: 1
      concurrentConsumers:
        kind: parameter
        group: common
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "1"
        description: How many concurrent listeners to schedule for the thread pool
        order: 2
      waitTimeMs:
        kind: parameter
        group: common
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "100"
        description: How long a given wait should block (server side) in milliseconds
        order: 3
      bridgeErrorHandler:
        kind: parameter
        group: consumer
        label: consumer
        type: boolean
        javaType: boolean
        optionalPrefix: consumer.
        deprecated: false
        secret: false
        defaultValue: false
        description: 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/ERROR level and ignored.
        order: 4
      exceptionHandler:
        kind: parameter
        group: consumer (advanced)
        label: consumer,advanced
        type: object
        javaType: org.apache.camel.spi.ExceptionHandler
        optionalPrefix: consumer.
        deprecated: false
        secret: false
        description: 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/ERROR level and ignored.
        order: 5
      exchangePattern:
        kind: parameter
        group: consumer (advanced)
        label: consumer,advanced
        type: string
        javaType: org.apache.camel.ExchangePattern
        enum:
        - InOnly
        - RobustInOnly
        - InOut
        - InOptionalOut
        - OutOnly
        - RobustOutOnly
        - OutIn
        - OutOptionalIn
        deprecated: false
        secret: false
        description: Sets the exchange pattern when the consumer creates an exchange.
        order: 6
      synchronous:
        kind: parameter
        group: advanced
        label: advanced
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
        order: 7
  documentation.adoc: |+
    [[Kestrel-KestrelComponent]]
    Kestrel Component
    ~~~~~~~~~~~~~~~~~

    The Kestrel component allows messages to be sent to a
    https://github.com/robey/kestrel[Kestrel] queue, or messages to be
    consumed from a Kestrel queue. This component uses the
    http://code.google.com/p/spymemcached/[spymemcached] client for
    memcached protocol communication with Kestrel servers.

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


    [[Kestrel-URIformat]]
    URI format
    ^^^^^^^^^^

    [source,java]
    -------------------------------------------
    kestrel://[addresslist/]queuename[?options]
    -------------------------------------------

    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:

    [source,java]
    -----------------------------
    kestrel://kserver01:22133/foo
    -----------------------------

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

    [source,java]
    -------------
    kestrel://foo
    -------------

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

    [source,java]
    -----------------------
    kestrel://kserver01/foo
    -----------------------

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

    [source,java]
    -----------------------------------------------------------------
    kestrel://kserver01:22133,kserver02:22133,kserver03:22133/massive
    -----------------------------------------------------------------

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

    [source,java]
    -----------------------------------------------------------------------
    kestrel://kserver03:22133/massive?concurrentConsumers=25&waitTimeMs=500
    -----------------------------------------------------------------------

    [[Kestrel-Options]]
    Options
    ^^^^^^^





    // component options: START
    The Kestrel component supports 1 options which are listed below.



    {% raw %}
    [width="100%",cols="2,1m,7",options="header"]
    |=======================================================================
    | Name | Java Type | Description
    | configuration | KestrelConfiguration | To use a shared configured configuration as base for creating new endpoints.
    |=======================================================================
    {% endraw %}
    // component options: END







    // endpoint options: START
    The Kestrel component supports 8 endpoint options which are listed below:

    {% raw %}
    [width="100%",cols="2,1,1m,1m,5",options="header"]
    |=======================================================================
    | Name | Group | Default | Java Type | Description
    | addresses | common | localhost:22133 | String[] | The address(es) on which kestrel is running
    | queue | common |  | String | *Required* The queue we are polling
    | concurrentConsumers | common | 1 | int | How many concurrent listeners to schedule for the thread pool
    | waitTimeMs | common | 100 | int | How long a given wait should block (server side) in milliseconds
    | bridgeErrorHandler | consumer | false | boolean | 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/ERROR level and ignored.
    | exceptionHandler | consumer (advanced) |  | ExceptionHandler | 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/ERROR level and ignored.
    | exchangePattern | consumer (advanced) |  | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange.
    | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
    |=======================================================================
    {% endraw %}
    // endpoint options: END



    [[Kestrel-ConfiguringtheKestrelcomponentusingSpringXML]]
    Configuring the Kestrel component using Spring XML
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    The simplest form of explicit configuration is as follows:

    [source,xml]
    ---------------------------------------------------------------------------------------------------------------
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

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

      <camelContext xmlns="http://camel.apache.org/schema/spring">
      </camelContext>

    </beans>
    ---------------------------------------------------------------------------------------------------------------

    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:

    [source,xml]
    ---------------------------------------------------------------------------------------------------------------
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

      <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>

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

      <camelContext xmlns="http://camel.apache.org/schema/spring">
      </camelContext>

    </beans>
    ---------------------------------------------------------------------------------------------------------------

    [[Kestrel-UsageExamples]]
    Usage Examples
    ^^^^^^^^^^^^^^

    [[Kestrel-Example1:Consuming]]
    Example 1: Consuming
    ++++++++++++++++++++

    [source,java]
    -------------------------------------------------------------------------------
    from("kestrel://kserver02:22133/massive?concurrentConsumers=10&waitTimeMs=500")
      .bean("myConsumer", "onMessage");
    -------------------------------------------------------------------------------

    [source,java]
    -------------------------------------------
    public class MyConsumer {
        public void onMessage(String message) {
            ...
        }
    }
    -------------------------------------------

    [[Kestrel-Example2:Producing]]
    Example 2: Producing
    ++++++++++++++++++++

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

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

    [[Kestrel-Example3:SpringXMLConfiguration]]
    Example 3: Spring XML Configuration
    +++++++++++++++++++++++++++++++++++

    [source,xml]
    ----------------------------------------------------------------------------------------
      <camelContext xmlns="http://camel.apache.org/schema/spring">
        <route>
          <from uri="kestrel://ks01:22133/sequential?concurrentConsumers=1&waitTimeMs=500"/>
          <bean ref="myBean" method="onMessage"/>
        </route>
        <route>
          <from uri="direct:start"/>
          <to uri="kestrel://ks02:22133/stuff"/>
        </route>
      </camelContext>
    ----------------------------------------------------------------------------------------

    [source,java]
    -------------------------------------------
    public class MyBean {
        public void onMessage(String message) {
            ...
        }
    }
    -------------------------------------------

    [[Kestrel-Dependencies]]
    Dependencies
    ^^^^^^^^^^^^

    The Kestrel component has the following dependencies:

    * `spymemcached` 2.5 (or greater)

    [[Kestrel-spymemcached]]
    spymemcached
    ++++++++++++

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

    [source,java]
    ------------------------------------
    <dependency>
      <groupId>spy</groupId>
      <artifactId>memcached</artifactId>
      <version>2.5</version>
    </dependency>
    ------------------------------------

    Alternatively, you can
    http://code.google.com/p/spymemcached/downloads/list[download the jar]
    directly.

    Warning: Limitations

    NOTE: 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
    http://download.oracle.com/javase/1.4.2/docs/guide/lang/assert.html[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
    http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html[surefire:test
    reference] for details.

    [[Kestrel-SeeAlso]]
    See Also
    ^^^^^^^^

    * link:configuring-camel.html[Configuring Camel]
    * link:component.html[Component]
    * link:endpoint.html[Endpoint]
    * link:getting-started.html[Getting Started]

