---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: context
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: context
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: context
        spec:
          containers:
          - image: funktion/connector-context:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: context
      syntax: context:contextId:localEndpointUrl
      title: Camel Context
      description: The context component allows to send/receive messages between Camel routes in a black box way.
      label: endpoint
      deprecated: true
      async: false
      javaType: org.apache.camel.component.context.QualifiedContextComponent
      groupId: org.apache.camel
      artifactId: camel-context
      version: 2.18.3
    componentProperties: {}
    properties:
      contextId:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Is the ID you used to register the CamelContext into the Registry.
        order: 0
      localEndpointUrl:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Can be a valid Camel URI evaluated within the black box CamelContext. Or it can be a logical name which is mapped to any local endpoints. For example if you locally have endpoints like direct:invoices and seda:purchaseOrders inside a CamelContext of id supplyChain then you can just use the URIs supplyChain:invoices or supplyChain:purchaseOrders to omit the physical endpoint kind and use pure logical URIs.
        order: 1
      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: 2
      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: 3
      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: 4
      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: 5
  documentation.adoc: "[[Context-ContextComponent]]\nContext Component\n~~~~~~~~~~~~~~~~~\n\
    \n*Available as of Camel 2.7*\n\nThe *context* component allows you to create\
    \ new Camel Components from a\nCamelContext with a number of routes which is then\
    \ treated as a black\nbox, allowing you to refer to the local endpoints within\
    \ the component\nfrom other CamelContexts.\n\nIt is similar to the link:routebox.html[Routebox]\
    \ component in idea,\nthough the Context component tries to be really simple for\
    \ end users;\njust a simple convention over configuration approach to refer to\
    \ local\nendpoints inside the CamelContext Component.\n\nMaven users will need\
    \ to add the following dependency to their `pom.xml`\nfor this component:\n\n\
    [source,xml]\n------------------------------------------------------------\n<dependency>\n\
    \    <groupId>org.apache.camel</groupId>\n    <artifactId>camel-context</artifactId>\n\
    \    <version>x.x.x</version>\n    <!-- use the same version as your Camel core\
    \ version -->\n</dependency>\n------------------------------------------------------------\n\
    \n[[Context-URIformat]]\nURI format\n^^^^^^^^^^\n\n[source,java]\n--------------------------------------------------\n\
    context:camelContextId:localEndpointName[?options]\n--------------------------------------------------\n\
    \nOr you can omit the \"context:\" prefix.\n\n[source,java]\n------------------------------------------\n\
    camelContextId:localEndpointName[?options]\n------------------------------------------\n\
    \n\n\n// component options: START\nThe Camel Context component has no options.\n\
    // component options: END\n\n\n\n// endpoint options: START\nThe Camel Context\
    \ component supports 6 endpoint options which are listed below:\n\n{% raw %}\n\
    [width=\"100%\",cols=\"2,1,1m,1m,5\",options=\"header\"]\n|=======================================================================\n\
    | Name | Group | Default | Java Type | Description\n| contextId | common |  |\
    \ String | *Required* Is the ID you used to register the CamelContext into the\
    \ Registry.\n| localEndpointUrl | common |  | String | *Required* Can be a valid\
    \ Camel URI evaluated within the black box CamelContext. Or it can be a logical\
    \ name which is mapped to any local endpoints. For example if you locally have\
    \ endpoints like direct:invoices and seda:purchaseOrders inside a CamelContext\
    \ of id supplyChain then you can just use the URIs supplyChain:invoices or supplyChain:purchaseOrders\
    \ to omit the physical endpoint kind and use pure logical URIs.\n| 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.\n| 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.\n| exchangePattern | consumer (advanced) |\
    \  | ExchangePattern | Sets the exchange pattern when the consumer creates an\
    \ exchange.\n| synchronous | advanced | false | boolean | Sets whether synchronous\
    \ processing should be strictly used or Camel is allowed to use asynchronous processing\
    \ (if supported).\n|=======================================================================\n\
    {% endraw %}\n// endpoint options: END\n\n\nYou can append query options to the\
    \ URI in the following format,\n`?option=value&option=value&...`\n\n[[Context-Example]]\n\
    Example\n^^^^^^^\n\nIn this example we'll create a black box context, then we'll\
    \ use it from\nanother CamelContext.\n\n[[Context-Definingthecontextcomponent]]\n\
    Defining the context component\n++++++++++++++++++++++++++++++\n\nFirst you need\
    \ to create a CamelContext, add some routes in it, start it\nand then register\
    \ the CamelContext into the link:registry.html[Registry]\n(JNDI, Spring, Guice\
    \ or OSGi etc).\n\nThis can be done in the usual Camel way from this\nhttp://svn.apache.org/viewvc/camel/trunk/components/camel-context/src/test/java/org/apache/camel/component/context/JavaDslBlackBoxTest.java?revision=1069442&view=markup[test\n\
    case] (see the createRegistry() method); this example shows Java and\nJNDI being\
    \ used...\n\n[source,java]\n------------------------------------------------------------------------------------\n\
    // lets create our black box as a camel context and a set of routes\nDefaultCamelContext\
    \ blackBox = new DefaultCamelContext(registry);\nblackBox.setName(\"blackBox\"\
    );\nblackBox.addRoutes(new RouteBuilder() {\n    @Override\n    public void configure()\
    \ throws Exception {\n        // receive purchase orders, lets process it in some\
    \ way then send an invoice\n        // to our invoice endpoint\n        from(\"\
    direct:purchaseOrder\").\n          setHeader(\"received\").constant(\"true\"\
    ).\n          to(\"direct:invoice\");\n    }\n});\nblackBox.start();\n\nregistry.bind(\"\
    accounts\", blackBox);\n------------------------------------------------------------------------------------\n\
    \nNotice in the above route we are using pure local endpoints (*direct*\nand *seda*).\
    \ Also note we expose this CamelContext using the *accounts*\nID. We can do the\
    \ same thing in Spring via\n\n[source,xml]\n--------------------------------------------------------------------------\n\
    <camelContext id=\"accounts\" xmlns=\"http://camel.apache.org/schema/spring\"\
    >\n  <route> \n    <from uri=\"direct:purchaseOrder\"/>\n    ...\n    <to uri=\"\
    direct:invoice\"/>\n  </route>\n</camelContext>\n--------------------------------------------------------------------------\n\
    \n[[Context-Usingthecontextcomponent]]\nUsing the context component\n+++++++++++++++++++++++++++\n\
    \nThen in another CamelContext we can then refer to this \"accounts black\nbox\"\
    \ by just sending to *accounts:purchaseOrder* and consuming from\n*accounts:invoice*.\n\
    \nIf you prefer to be more verbose and explicit you could use\n*context:accounts:purchaseOrder*\
    \ or even\n*context:accounts:direct://purchaseOrder* if you prefer. But using\n\
    logical endpoint URIs is preferred as it hides the implementation detail\nand\
    \ provides a simple logical naming scheme.\n\nFor example if we wish to then expose\
    \ this accounts black box on some\nmiddleware (outside of the black box) we can\
    \ do things like...\n\n[source,xml]\n--------------------------------------------------------------------------------\n\
    <camelContext xmlns=\"http://camel.apache.org/schema/spring\">\n  <route> \n \
    \   <!-- consume from an ActiveMQ into the black box -->\n    <from uri=\"activemq:Accounts.PurchaseOrders\"\
    />\n    <to uri=\"accounts:purchaseOrders\"/>\n  </route>\n  <route> \n    <!--\
    \ lets send invoices from the black box to a different ActiveMQ Queue -->\n  \
    \  <from uri=\"accounts:invoice\"/>\n    <to uri=\"activemq:UK.Accounts.Invoices\"\
    />\n  </route>\n</camelContext>\n--------------------------------------------------------------------------------\n\
    \n[[Context-Namingendpoints]]\nNaming endpoints\n++++++++++++++++\n\nA context\
    \ component instance can have many public input and output\nendpoints that can\
    \ be accessed from outside it's CamelContext. When\nthere are many it is recommended\
    \ that you use logical names for them to\nhide the middleware as shown above.\n\
    \nHowever when there is only one input, output or error/dead letter\nendpoint\
    \ in a component we recommend using the common posix shell names\n*in*, *out*\
    \ and *err*\n"
