signal_workflow_execution ( $opt )

Records a WorkflowExecutionSignaled event in the workflow execution history and creates a decision task for the workflow execution identified by the given domain, workflowId and runId. The event is recorded with the specified user defined signalName and input (if provided).

If a runId is not specified, then the WorkflowExecutionSignaled event is recorded in the history of the current open workflow with the matching workflowId in the domain.

If the specified workflow execution is not open, this method fails with UnknownResource.

Access Control

You can use IAM policies to control this action’s access to Amazon SWF resources as follows:

  • Use a Resource element with the domain name to limit the action to only specified domains.
  • Use an Action element to allow or deny permission to call this action.
  • You cannot use an IAM policy to constrain this action’s parameters.

If the caller does not have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails by throwing OperationNotPermitted. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows.

Access

public

Parameters

Parameter

Type

Required

Description

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • domain - string - Required - The name of the domain containing the workflow execution to signal.
  • workflowId - string - Required - The workflowId of the workflow execution to signal.
  • runId - string - Optional - The runId of the workflow execution to signal.
  • signalName - string - Required - The name of the signal. This name must be meaningful to the target workflow.
  • input - string - Optional - Data to attach to the WorkflowExecutionSignaled event in the target workflow execution’s history.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Signal and Cancel a Workflow Execution

Shows an example of signaling and canceling a workflow execution.

This sample uses anonymous functions, which are only available in PHP 5.3+. For PHP 5.2 users, you must used named functions instead of anonymous ones.

$swf = new AmazonSWF();

// Setup
$timestamp = time();
$workflow_domain = 'my-domain' . $timestamp;
$workflow_type_name = 'my-workflow-type';
$activity_type_name = 'my-activity-type';

//-----------------------------------------------------------------//
// Signal the workflow with an event and new data

echo '# Signaling the workflow with an event and new data...' . PHP_EOL;
$signal = $swf->signal_workflow_execution(array(
	'domain'     => $workflow_domain,
	'workflowId' => 'my-workflow-execution',
	'runId'      => $run_id,
	'signalName' => 'my-test-signal',
	'input'      => 'data for my test signal'
));

if ($signal->isOK())
{
	echo 'Successfully signaled the workflow with an event and new data.' . PHP_EOL;
}
else
{
	echo 'Failed to signal the workflow an new event.' . PHP_EOL;
}

echo PHP_EOL;

//-----------------------------------------------------------------//
// Cancel a workflow execution

echo '# Canceling the workflow execution...' . PHP_EOL;
$cancel = $swf->request_cancel_workflow_execution(array(
	'domain'     => $workflow_domain,
	'workflowId' => 'my-workflow-execution',
	'runId'      => $run_id
));

if ($cancel->isOK())
{
	echo 'Successfully canceled the workflow.' . PHP_EOL;
}
else
{
	echo 'Failed to cancel the workflow.' . PHP_EOL;
}

echo PHP_EOL;

Source

Method defined in services/swf.class.php | Toggle source view (6 lines) | View on GitHub

public function signal_workflow_execution($opt = null)
{
    if (!$opt) $opt = array();
    
    return $this->authenticate('SignalWorkflowExecution', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback