此内容没有您所选择的语言版本。
Chapter 36. AWS Simple Workflow Component
Available as of Camel version 2.13
The Simple Workflow component supports managing workflows from 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 Amazon Simple Workflow.
36.1. URI Format
aws-swf://<workflow|activity>[?options]
You can append query options to the URI in the following format, ?options=value&option2=value&…
36.2. URI Options
The AWS Simple Workflow component supports 5 options which are listed below.
Name | Description | Default | Type |
---|---|---|---|
configuration (advanced) | The AWS SWF default configuration | SWFConfiguration | |
accessKey (common) | Amazon AWS Access Key. | String | |
secretKey (common) | Amazon AWS Secret Key. | String | |
region (common) | Amazon AWS Region. | String | |
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. | true | boolean |
The AWS Simple Workflow endpoint is configured using URI syntax:
aws-swf:type
with the following path and query parameters:
36.2.1. Path Parameters (1 parameters):
Name | Description | Default | Type |
---|---|---|---|
type | Required Activity or workflow | String |
36.2.2. Query Parameters (30 parameters):
Name | Description | Default | Type |
---|---|---|---|
amazonSWClient (common) | To use the given AmazonSimpleWorkflowClient as client | AmazonSimpleWorkflow Client | |
dataConverter (common) | An instance of com.amazonaws.services.simpleworkflow.flow.DataConverter to use for serializing/deserializing the data. | DataConverter | |
domainName (common) | The workflow domain to use. | String | |
eventName (common) | The workflow or activity event name to use. | String | |
region (common) | Amazon AWS Region. | String | |
version (common) | The workflow or activity event version to use. | String | |
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. | false | boolean |
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. | ExceptionHandler | |
exchangePattern (consumer) | Sets the exchange pattern when the consumer creates an exchange. | ExchangePattern | |
clientConfiguration Parameters (advanced) | To configure the ClientConfiguration using the key/values from the Map. | Map | |
startWorkflowOptions Parameters (advanced) | To configure the StartWorkflowOptions using the key/values from the Map. | Map | |
sWClientParameters (advanced) | To configure the AmazonSimpleWorkflowClient using the key/values from the Map. | Map | |
synchronous (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean |
activityList (activity) | The list name to consume activities from. | String | |
activitySchedulingOptions (activity) | Activity scheduling options | ActivityScheduling Options | |
activityThreadPoolSize (activity) | Maximum number of threads in work pool for activity. | 100 | int |
activityTypeExecution Options (activity) | Activity execution options | ActivityTypeExecution Options | |
activityTypeRegistration Options (activity) | Activity registration options | ActivityType RegistrationOptions | |
childPolicy (workflow) | The policy to use on child workflows when terminating a workflow. | String | |
executionStartToClose Timeout (workflow) | Set the execution start to close timeout. | 3600 | String |
operation (workflow) | Workflow operation | START | String |
signalName (workflow) | The name of the signal to send to the workflow. | String | |
stateResultType (workflow) | The type of the result when a workflow state is queried. | String | |
taskStartToCloseTimeout (workflow) | Set the task start to close timeout. | 600 | String |
terminationDetails (workflow) | Details for terminating a workflow. | String | |
terminationReason (workflow) | The reason for terminating a workflow. | String | |
workflowList (workflow) | The list name to consume workflows from. | String | |
workflowTypeRegistration Options (workflow) | Workflow registration options | WorkflowType RegistrationOptions | |
accessKey (security) | Amazon AWS Access Key. | String | |
secretKey (security) | Amazon AWS Secret Key. | String |
Required SWF component options
You have to provide the amazonSWClient in the Registry or your accessKey and secretKey to access the Amazon’s Simple Workflow Service.
36.3. Usage
36.3.1. 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.
Header | Type | Description |
---|---|---|
|
|
The operation to perform on the workflow. Supported operations are: |
|
| A workflow ID to use. |
|
| A worfklow run ID to use. |
|
| The type of the result when a workflow state is queried. |
|
| The workflow or activity event name to use. |
|
| The workflow or activity event version to use. |
|
| The reason for terminating a workflow. |
|
| Details for terminating a workflow. |
|
| The policy to use on child workflows when terminating a workflow. |
36.3.2. Message headers set by the SWF Workflow Producer
Header | Type | Description |
---|---|---|
|
| The worfklow ID used or newly generated. |
|
| The worfklow run ID used or generated. |
36.3.3. 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.
Header | Type | Description |
---|---|---|
|
| Indicates what type is the current event: CamelSWFActionExecute, CamelSWFSignalReceivedAction or CamelSWFGetStateAction. |
|
| Indicates whether the current decision task is a replay or not. |
|
| The time of the start event for this decision task. |
36.3.4. 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.
Header | Type | Description |
---|---|---|
|
| The activity name to schedule. |
|
| The activity version to schedule. |
36.3.5. Message headers set by the SWF Activity Consumer
Header | Type | Description |
---|---|---|
|
| The task token that is required to report task completion for manually completed tasks. |
36.3.6. 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 Registry.
For example if your Camel Application is running behind a firewall:
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);
36.4. Dependencies
Maven users will need to add the following dependency to their pom.xml.
pom.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).
36.5. See Also
- Configuring Camel
- Component
- Endpoint
- Getting Started
AWS Component