Menu
AWS Step Functions
Developer Guide

Activities

Activities are an AWS Step Functions concept that refers to a task to be performed by a worker that can be hosted on EC2, ECS, mobile devices—basically anywhere.

Creating an Activity

Activities are referred to by name. An activity's name can be any string that adheres to the following rules:

  • It must be between 0 – 80 characters in length.

  • It must be unique within your AWS account and region.

Activities can be created with Step Functions in any of the following ways:

Note

Activities are not versioned and are expected to always be backwards compatible. If you must make a backwards-incompatible change to an activity definition, then a new activity should be created with Step Functions using a unique name.

Writing a Worker

Workers can be implemented in any language that can make AWS Step Functions API actions. Workers should repeatedly poll for work by implementing the following pseudo-code algorithm:

[taskToken, jsonInput] = GetActivityTask();
try {
     // Do some work...
     SendTaskSuccess(taskToken, jsonOutput);
 } catch (Exception e) {
     SendTaskFailure(taskToken, reason, errorCode);
}

Sending Heartbeat Notifications

States that have long-running activities should provide a heartbeat timeout value to verify that the activity is still running successfully.

If your activity has a heartbeat timeout value, the worker which implements it must send heartbeat updates to Step Functions. To send a heartbeat notification from a worker, use the SendTaskHeartbeat action.