Did this page help you?

   Yes   No   Tell us about it...

com.amazonaws.services.simpleworkflow.flow.generic
Class WorkflowDefinition

java.lang.Object
  extended by com.amazonaws.services.simpleworkflow.flow.generic.WorkflowDefinition
Direct Known Subclasses:
POJOWorkflowDefinition

public abstract class WorkflowDefinition
extends Object

Base class for all workflow definitions. Implementation should use Execute to specify workflow name different from implementation class name, different workflow version and other workflow instance registration and execution parameters.

See Also:
Execute

Constructor Summary
WorkflowDefinition()
           
 
Method Summary
abstract  Promise<String> execute(String input)
          Asynchronous method that implements workflow business logic.
abstract  String getWorkflowState()
          Return state that is inserted decision completion through RespondDecisionTaskCompletedRequest.setExecutionContext(String) and later can be retrieved through AmazonSimpleWorkflow.describeWorkflowExecution(com.amazonaws.services.simpleworkflow.model.DescribeWorkflowExecutionRequest) visibility call.
abstract  void signalRecieved(String signalName, String input)
          Asynchronous method that implements signals handling logic.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowDefinition

public WorkflowDefinition()
Method Detail

execute

public abstract Promise<String> execute(String input)
                                 throws WorkflowException
Asynchronous method that implements workflow business logic. This method invocation is surrounded by TryCatchFinally. Workflow is completed when TryCatchFinally.doFinally() is executed. So even if return Promise of the method is ready but there is some asynchronous task or activity still not completed workflow is not going to complete.

Parameters:
input - Data passed to the worklfow instance during start instance call.
Returns:
Throws:
WorkflowException - Prefer throwing WorkflowException.

signalRecieved

public abstract void signalRecieved(String signalName,
                                    String input)
                             throws WorkflowException
Asynchronous method that implements signals handling logic. This method invocation is surrounded by the same doTry of TryCatchFinally that is used to execute workflow. It means that non handled failure inside this method causes workflow execution failure.

Throws:
Exception - Prefer throwing WorkflowException.
Exception
WorkflowException

getWorkflowState

public abstract String getWorkflowState()
                                 throws WorkflowException
Return state that is inserted decision completion through RespondDecisionTaskCompletedRequest.setExecutionContext(String) and later can be retrieved through AmazonSimpleWorkflow.describeWorkflowExecution(com.amazonaws.services.simpleworkflow.model.DescribeWorkflowExecutionRequest) visibility call. Implementation of this call is expected to be synchronous and is not allowed to invoke any asynchronous operations like creation of new Task or calling methods marked with Asynchronous annotation. It is also expected to be read only operation which is not allowed to modify state of workflow in any way.

Returns:
current state of the workflow execution.
Throws:
WorkflowException


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.