Example usage for com.amazonaws.services.simpleworkflow AmazonSimpleWorkflow startWorkflowExecution

List of usage examples for com.amazonaws.services.simpleworkflow AmazonSimpleWorkflow startWorkflowExecution

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleworkflow AmazonSimpleWorkflow startWorkflowExecution.

Prototype

Run startWorkflowExecution(StartWorkflowExecutionRequest startWorkflowExecutionRequest);

Source Link

Document

Starts an execution of the workflow type in the specified domain using the provided workflowId and input data.

Usage

From source file:example.swf.hellolambda.WorkflowStarter.java

License:Apache License

public static void main(String[] args) {
    final String WORKFLOW_EXECUTION = "HelloWorld-Lambda-Execution";
    AmazonSimpleWorkflow swf = AmazonSimpleWorkflowClientBuilder.defaultClient();

    String workflow_input = "{\"who\": \"Amazon SWF\"}";

    if (args.length > 0) {
        workflow_input = "{\"who\": \"" + args[0] + "\"}";
    }//w ww.  j  ava2s  .c om

    System.out.println("Starting the workflow execution '" + WORKFLOW_EXECUTION + "' with input '"
            + workflow_input + "'.");

    WorkflowType wf_type = new WorkflowType().withName(HelloTypes.WORKFLOW)
            .withVersion(HelloTypes.WORKFLOW_VERSION);

    Run run = swf.startWorkflowExecution(new StartWorkflowExecutionRequest().withDomain(HelloTypes.DOMAIN)
            .withWorkflowType(wf_type).withWorkflowId(WORKFLOW_EXECUTION).withInput(workflow_input)
            .withExecutionStartToCloseTimeout("90"));

    System.out.println("Workflow execution started with the run id '" + run.getRunId() + "'.");
}