---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: aws-swf
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: aws-swf
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: aws-swf
        spec:
          containers:
          - image: funktion/connector-aws-swf:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: aws-swf
      syntax: aws-swf:type
      title: AWS Simple Workflow
      description: The aws-swf component is used for managing workflows from Amazon Simple Workflow.
      label: cloud,workflow
      deprecated: false
      async: false
      javaType: org.apache.camel.component.aws.swf.SWFComponent
      groupId: org.apache.camel
      artifactId: camel-aws
      version: 2.18.3
    componentProperties: {}
    properties:
      type:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        enum:
        - activity
        - workflow
        deprecated: false
        secret: false
        description: Activity or workflow
        order: 0
      accessKey:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Amazon AWS Access Key.
        order: 1
      amazonSWClient:
        kind: parameter
        group: common
        type: object
        javaType: com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient
        deprecated: false
        secret: false
        description: To use the given AmazonSimpleWorkflowClient as client
        order: 2
      dataConverter:
        kind: parameter
        group: common
        type: object
        javaType: com.amazonaws.services.simpleworkflow.flow.DataConverter
        deprecated: false
        secret: false
        description: An instance of com.amazonaws.services.simpleworkflow.flow.DataConverter to use for serializing/deserializing the data.
        order: 3
      domainName:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The workflow domain to use.
        order: 4
      eventName:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The workflow or activity event name to use.
        order: 5
      secretKey:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Amazon AWS Secret Key.
        order: 6
      version:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The workflow or activity event version to use.
        order: 7
      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: 8
      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: 9
      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: 10
      clientConfigurationParameters:
        kind: parameter
        group: advanced
        label: advanced
        type: object
        javaType: java.util.Map<java.lang.String,java.lang.Object>
        prefix: clientConfiguration.
        multiValue: true
        deprecated: false
        secret: false
        description: To configure the ClientConfiguration using the key/values from the Map.
        order: 11
      startWorkflowOptionsParameters:
        kind: parameter
        group: advanced
        label: advanced
        type: object
        javaType: java.util.Map<java.lang.String,java.lang.Object>
        prefix: startWorkflowOptions.
        multiValue: true
        deprecated: false
        secret: false
        description: To configure the StartWorkflowOptions using the key/values from the Map.
        order: 12
      sWClientParameters:
        kind: parameter
        group: advanced
        label: advanced
        type: object
        javaType: java.util.Map<java.lang.String,java.lang.Object>
        prefix: sWClient.
        multiValue: true
        deprecated: false
        secret: false
        description: To configure the AmazonSimpleWorkflowClient using the key/values from the Map.
        order: 13
      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: 14
      activityList:
        kind: parameter
        group: activity
        label: consumer,activity
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The list name to consume activities from.
        order: 15
      activitySchedulingOptions:
        kind: parameter
        group: activity
        label: producer,activity
        type: object
        javaType: com.amazonaws.services.simpleworkflow.flow.ActivitySchedulingOptions
        deprecated: false
        secret: false
        description: Activity scheduling options
        order: 16
      activityThreadPoolSize:
        kind: parameter
        group: activity
        label: consumer,activity
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "100"
        description: Maximum number of threads in work pool for activity.
        order: 17
      activityTypeExecutionOptions:
        kind: parameter
        group: activity
        label: consumer,activity
        type: object
        javaType: com.amazonaws.services.simpleworkflow.flow.worker.ActivityTypeExecutionOptions
        deprecated: false
        secret: false
        description: Activity execution options
        order: 18
      activityTypeRegistrationOptions:
        kind: parameter
        group: activity
        label: consumer,activity
        type: object
        javaType: com.amazonaws.services.simpleworkflow.flow.worker.ActivityTypeRegistrationOptions
        deprecated: false
        secret: false
        description: Activity registration options
        order: 19
      childPolicy:
        kind: parameter
        group: workflow
        label: producer,workflow
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The policy to use on child workflows when terminating a workflow.
        order: 20
      executionStartToCloseTimeout:
        kind: parameter
        group: workflow
        label: producer,workflow
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        defaultValue: "3600"
        description: Set the execution start to close timeout.
        order: 21
      operation:
        kind: parameter
        group: workflow
        label: producer,workflow
        type: string
        javaType: java.lang.String
        enum:
        - SIGNAL
        - CANCEL
        - TERMINATE
        - GET_STATE
        - START
        - DESCRIBE
        - GET_HISTORY
        deprecated: false
        secret: false
        defaultValue: START
        description: Workflow operation
        order: 22
      signalName:
        kind: parameter
        group: workflow
        label: producer,workflow
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The name of the signal to send to the workflow.
        order: 23
      stateResultType:
        kind: parameter
        group: workflow
        label: producer,workflow
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The type of the result when a workflow state is queried.
        order: 24
      taskStartToCloseTimeout:
        kind: parameter
        group: workflow
        label: producer,workflow
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        defaultValue: "600"
        description: Set the task start to close timeout.
        order: 25
      terminationDetails:
        kind: parameter
        group: workflow
        label: producer,workflow
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Details for terminating a workflow.
        order: 26
      terminationReason:
        kind: parameter
        group: workflow
        label: producer,workflow
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The reason for terminating a workflow.
        order: 27
      workflowList:
        kind: parameter
        group: workflow
        label: consumer,workflow
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The list name to consume workflows from.
        order: 28
      workflowTypeRegistrationOptions:
        kind: parameter
        group: workflow
        label: consumer,workflow
        type: object
        javaType: com.amazonaws.services.simpleworkflow.flow.WorkflowTypeRegistrationOptions
        deprecated: false
        secret: false
        description: Workflow registration options
        order: 29
  documentation.adoc: |
    [[AWS-SWF-SWFComponent]]
    SWF Component
    ~~~~~~~~~~~~~

    *Available as of Camel 2.13*

    The Simple Workflow component supports managing workflows from
    http://aws.amazon.com/swf/[Amazon's Simple Workflow] service.

    Prerequisites

    You must have a valid Amazon Web Services developer account, and be
    signed up to use Amazon Simple Workflow. More information are available
    at http://aws.amazon.com/swf/[Amazon Simple Workflow].

    [[AWS-SWF-URIFormat]]
    URI Format
    ^^^^^^^^^^

    [source,java]
    ---------------------------------------
    aws-swf://<workflow|activity>[?options]
    ---------------------------------------

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

    [[AWS-SWF-URIOptions]]
    URI Options
    ^^^^^^^^^^^


    // component options: START
    The AWS Simple Workflow component has no options.
    // component options: END




    // endpoint options: START
    The AWS Simple Workflow component supports 30 endpoint options which are listed below:

    {% raw %}
    [width="100%",cols="2,1,1m,1m,5",options="header"]
    |=======================================================================
    | Name | Group | Default | Java Type | Description
    | type | common |  | String | *Required* Activity or workflow
    | accessKey | common |  | String | Amazon AWS Access Key.
    | amazonSWClient | common |  | AmazonSimpleWorkflowClient | To use the given AmazonSimpleWorkflowClient as client
    | dataConverter | common |  | DataConverter | An instance of com.amazonaws.services.simpleworkflow.flow.DataConverter to use for serializing/deserializing the data.
    | domainName | common |  | String | The workflow domain to use.
    | eventName | common |  | String | The workflow or activity event name to use.
    | secretKey | common |  | String | Amazon AWS Secret Key.
    | version | common |  | String | The workflow or activity event version to use.
    | 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.
    | clientConfigurationParameters | advanced |  | Map | To configure the ClientConfiguration using the key/values from the Map.
    | startWorkflowOptionsParameters | advanced |  | Map | To configure the StartWorkflowOptions using the key/values from the Map.
    | sWClientParameters | advanced |  | Map | To configure the AmazonSimpleWorkflowClient using the key/values from the Map.
    | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
    | activityList | activity |  | String | The list name to consume activities from.
    | activitySchedulingOptions | activity |  | ActivitySchedulingOptions | Activity scheduling options
    | activityThreadPoolSize | activity | 100 | int | Maximum number of threads in work pool for activity.
    | activityTypeExecutionOptions | activity |  | ActivityTypeExecutionOptions | Activity execution options
    | activityTypeRegistrationOptions | activity |  | ActivityTypeRegistrationOptions | Activity registration options
    | childPolicy | workflow |  | String | The policy to use on child workflows when terminating a workflow.
    | executionStartToCloseTimeout | workflow | 3600 | String | Set the execution start to close timeout.
    | operation | workflow | START | String | Workflow operation
    | signalName | workflow |  | String | The name of the signal to send to the workflow.
    | stateResultType | workflow |  | String | The type of the result when a workflow state is queried.
    | taskStartToCloseTimeout | workflow | 600 | String | Set the task start to close timeout.
    | terminationDetails | workflow |  | String | Details for terminating a workflow.
    | terminationReason | workflow |  | String | The reason for terminating a workflow.
    | workflowList | workflow |  | String | The list name to consume workflows from.
    | workflowTypeRegistrationOptions | workflow |  | WorkflowTypeRegistrationOptions | Workflow registration options
    |=======================================================================
    {% endraw %}
    // endpoint options: END



    Required SWF component options

    You have to provide the amazonSWClient in the
    link:registry.html[Registry] or your accessKey and secretKey to access
    the http://aws.amazon.com/swf[Amazon's Simple Workflow Service].

    [[AWS-SWF-Usage]]
    Usage
    ^^^^^

    [[AWS-SWF-MessageheadersevaluatedbytheSWFWorkflowProducer]]
    Message headers evaluated by the SWF Workflow Producer
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++

    A workflow producer allows interacting with a workflow. It can start a
    new workflow execution, query its state, send signals to a running
    workflow, or terminate and cancel it.

    [width="100%",cols="10%,10%,80%",options="header",]
    |=======================================================================
    |Header |Type |Description

    |`CamelSWFOperation` |`String` |The operation to perform on the workflow. Supported operations are:  +
     SIGNAL, CANCEL, TERMINATE, GET_STATE, START, DESCRIBE, GET_HISTORY.

    |`CamelSWFWorkflowId` |`String` |A workflow ID to use.

    |`CamelAwsDdbKeyCamelSWFRunId` |`String` |A worfklow run ID to use.

    |`CamelSWFStateResultType` |`String` |The type of the result when a workflow state is queried.

    |`CamelSWFEventName` |`String` |The workflow or activity event name to use.

    |`CamelSWFVersion` |`String` |The workflow or activity event version to use.

    |`CamelSWFReason` |`String` |The reason for terminating a workflow.

    |`CamelSWFDetails` |`String` |Details for terminating a workflow.

    |`CamelSWFChildPolicy` |`String` |The policy to use on child workflows when terminating a workflow.
    |=======================================================================

    [[AWS-SWF-MessageheaderssetbytheSWFWorkflowProducer]]
    Message headers set by the SWF Workflow Producer
    ++++++++++++++++++++++++++++++++++++++++++++++++

    [width="100%",cols="10%,10%,80%",options="header",]
    |=======================================================================
    |Header |Type |Description

    |`CamelSWFWorkflowId` |`String` |The worfklow ID used or newly generated.

    |`CamelAwsDdbKeyCamelSWFRunId` |`String` |The worfklow run ID used or generated.
    |=======================================================================

    [[AWS-SWF-MessageheaderssetbytheSWFWorkflowConsumer]]
    Message headers set by the SWF Workflow Consumer
    ++++++++++++++++++++++++++++++++++++++++++++++++

    A workflow consumer represents the workflow logic. When it is started,
    it will start polling workflow decision tasks and process them. In
    addition to processing decision tasks, a workflow consumer route, will
    also receive signals (send from a workflow producer) or state queries.
    The primary purpose of a workflow consumer is to schedule activity tasks
    for execution using activity producers. Actually activity tasks can be
    scheduled only from a thread started by a workflow consumer.

    [width="100%",cols="10%,10%,80%",options="header",]
    |=======================================================================
    |Header |Type |Description

    |`CamelSWFAction` |`String` |Indicates what type is the current event: CamelSWFActionExecute,
    CamelSWFSignalReceivedAction or CamelSWFGetStateAction.

    |`CamelSWFWorkflowReplaying` |`boolean` |Indicates whether the current decision task is a replay or not.

    |`CamelSWFWorkflowStartTime` |`long` |The time of the start event for this decision task.
    |=======================================================================

    [[AWS-SWF-MessageheaderssetbytheSWFActivityProducer]]
    Message headers set by the SWF Activity Producer
    ++++++++++++++++++++++++++++++++++++++++++++++++

    An activity producer allows scheduling activity tasks. An activity
    producer can be used only from a thread started by a workflow consumer
    ie, it can process synchronous exchanges started by a workflow consumer.

    [width="100%",cols="10%,10%,80%",options="header",]
    |=======================================================================
    |Header |Type |Description

    |`CamelSWFEventName` |`String` |The activity name to schedule.

    |`CamelSWFVersion` |`String` |The activity version to schedule.
    |=======================================================================

    [[AWS-SWF-MessageheaderssetbytheSWFActivityConsumer]]
    Message headers set by the SWF Activity Consumer
    ++++++++++++++++++++++++++++++++++++++++++++++++

    [width="100%",cols="10%,10%,80%",options="header",]
    |=======================================================================
    |Header |Type |Description

    |`CamelSWFTaskToken` |`String` |The task token that is required to report task completion for manually
    completed tasks.
    |=======================================================================

    [[AWS-SWF-AdvancedamazonSWClientconfiguration]]
    Advanced amazonSWClient configuration
    +++++++++++++++++++++++++++++++++++++

    If you need more control over the AmazonSimpleWorkflowClient instance
    configuration you can create your own instance and refer to it from the
    URI:

    The `#client` refers to a AmazonSimpleWorkflowClient in the
    link:registry.html[Registry].

    For example if your Camel Application is running behind a firewall:

    [source,java]
    --------------------------------------------------------------------------------------------------------
    AWSCredentials awsCredentials = new BasicAWSCredentials("myAccessKey", "mySecretKey");
    ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setProxyHost("http://myProxyHost");
    clientConfiguration.setProxyPort(8080);

    AmazonSimpleWorkflowClient client = new AmazonSimpleWorkflowClient(awsCredentials, clientConfiguration);

    registry.bind("client", client);
    --------------------------------------------------------------------------------------------------------

    [[AWS-SWF-Dependencies]]
    Dependencies
    ^^^^^^^^^^^^

    Maven users will need to add the following dependency to their pom.xml.

    *pom.xml*

    [source,xml]
    ---------------------------------------
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-aws</artifactId>
        <version>${camel-version}</version>
    </dependency>
    ---------------------------------------

    where `${camel-version`} must be replaced by the actual version of Camel
    (2.13 or higher).

    [[AWS-SWF-SeeAlso]]
    See Also
    ^^^^^^^^

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

    link:aws.html[AWS Component]
