---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: javaspace
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: javaspace
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: javaspace
        spec:
          containers:
          - image: funktion/connector-javaspace:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: javaspace
      syntax: javaspace:url
      title: JavaSpace
      description: Sending and receiving messages through JavaSpace.
      label: messaging
      deprecated: true
      async: false
      javaType: org.apache.camel.component.javaspace.JavaSpaceComponent
      groupId: org.apache.camel
      artifactId: camel-javaspace
      version: 2.18.3
    componentProperties: {}
    properties:
      url:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The URL to the JavaSpace server
        order: 0
      spaceName:
        kind: parameter
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Specifies the JavaSpace name.
        order: 1
      transactional:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: If true sending and receiving entries is performed within a transaction.
        order: 2
      transactionTimeout:
        kind: parameter
        group: common
        type: integer
        javaType: long
        deprecated: false
        secret: false
        description: Specifies the transaction timeout in millis. By default there is no timeout.
        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
      concurrentConsumers:
        kind: parameter
        group: consumer
        label: consumer
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "1"
        description: Specifies the number of concurrent consumers getting entries from the JavaSpace.
        order: 5
      templateId:
        kind: parameter
        group: consumer
        label: consumer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: If present this option specifies the Spring bean ID of the template to use for reading/taking entries.
        order: 6
      verb:
        kind: parameter
        group: consumer
        label: consumer
        type: string
        javaType: java.lang.String
        enum:
        - take
        - read
        deprecated: false
        secret: false
        defaultValue: take
        description: Specifies the verb for getting JavaSpace entries.
        order: 7
      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: 8
      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: 9
      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: 10
  documentation.adoc: |+
    [[JavaSpace-JavaSpaceComponent]]
    JavaSpace Component
    ~~~~~~~~~~~~~~~~~~~

    *Available as of Camel 2.1*

    The *javaspace* component is a transport for working with any JavaSpace
    compliant implementation and this component has been tested with both
    the http://www.dancres.org/blitz/[Blitz implementation] and the
    http://www.gigaspaces.com/[GigaSpace implementation]. +
     This component can be used for sending and receiving any object
    inheriting from the Jini `net.jini.core.entry.Entry` class. It is also
    possible to pass the bean ID of a template that can be used for
    reading/taking the entries from the space. +
     This component can be used for sending/receiving any serializable
    object acting as a sort of generic transport. The JavaSpace component
    contains a special optimization for dealing with the `BeanExchange`. It
    can be used to invoke a POJO remotely, using a JavaSpace as a
    transport. +
     This latter feature can provide a simple implementation of the
    master/worker pattern, where a POJO provides the business logic for the
    worker. +
     Look at the test cases for examples of various use cases for this
    component.

    Maven users will need to add the following dependency to their `pom.xml`
    for this component:

    [source,xml]
    ------------------------------------------------------------
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-javaspace</artifactId>
        <version>x.x.x</version>
        <!-- use the same version as your Camel core version -->
    </dependency>
    ------------------------------------------------------------

    [[JavaSpace-URIformat]]
    URI format
    ^^^^^^^^^^

    [source,java]
    -------------------------------
    javaspace:jini://host[?options]
    -------------------------------

    You can append query options to the URI in the following format,
    `?option=value&option=value&...`

    [[JavaSpace-Options]]
    Options
    ^^^^^^^


    // component options: START
    The JavaSpace component has no options.
    // component options: END




    // endpoint options: START
    The JavaSpace component supports 11 endpoint options which are listed below:

    {% raw %}
    [width="100%",cols="2,1,1m,1m,5",options="header"]
    |=======================================================================
    | Name | Group | Default | Java Type | Description
    | url | common |  | String | *Required* The URL to the JavaSpace server
    | spaceName | common |  | String | *Required* Specifies the JavaSpace name.
    | transactional | common | false | boolean | If true sending and receiving entries is performed within a transaction.
    | transactionTimeout | common |  | long | Specifies the transaction timeout in millis. By default there is no timeout.
    | 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.
    | concurrentConsumers | consumer | 1 | int | Specifies the number of concurrent consumers getting entries from the JavaSpace.
    | templateId | consumer |  | String | If present this option specifies the Spring bean ID of the template to use for reading/taking entries.
    | verb | consumer | take | String | Specifies the verb for getting JavaSpace entries.
    | 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



    [[JavaSpace-Examples]]
    Examples
    ^^^^^^^^

    [[JavaSpace-SendingandReceivingEntries]]
    Sending and Receiving Entries
    +++++++++++++++++++++++++++++

    [source,java]
    --------------------------------------------------------------------------------------------------------
    // sending route
    from("direct:input")
        .to("javaspace:jini://localhost?spaceName=mySpace");

    // receiving Route
    from("javaspace:jini://localhost?spaceName=mySpace&templateId=template&verb=take&concurrentConsumers=1")
        .to("mock:foo");
    --------------------------------------------------------------------------------------------------------

    In this case the payload can be any object that inherits from the Jini
    `Entry` type.

    [[JavaSpace-Sendingandreceivingserializableobjects]]
    Sending and receiving serializable objects
    ++++++++++++++++++++++++++++++++++++++++++

    Using the preceding routes, it is also possible to send and receive any
    serializable object. The JavaSpace component detects that the payload is
    not a Jini `Entry` and then it automatically wraps the payload with a
    Camel Jini `Entry`. In this way, a JavaSpace can be used as a generic
    transport mechanism.

    [[JavaSpace-UsingJavaSpaceasaremoteinvocationtransport]]
    Using JavaSpace as a remote invocation transport
    ++++++++++++++++++++++++++++++++++++++++++++++++

    The JavaSpace component has been tailored to work in combination with
    the Camel bean component. It is therefore possible to call a remote POJO
    using JavaSpace as the transport:

    [source,java]
    ---------------------------------------------------------------------------
    // client side
    from("direct:input")
        .to("javaspace:jini://localhost?spaceName=mySpace");

    // server side
    from("javaspace:jini://localhost?concurrentConsumers=10&spaceName=mySpace")
        .to("mock:foo");
    ---------------------------------------------------------------------------

    In the code there are two test cases showing how to use a POJO to
    realize the master/worker pattern. The idea is to use the POJO to
    provide the business logic and rely on Camel for sending/receiving
    requests/replies with the proper correlation.

    [[JavaSpace-SeeAlso]]
    See Also
    ^^^^^^^^

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

