This sample shows a workflow that can be used to run tasks periodically.
- You must have a valid Amazon Web Services developer account.
- Requires the AWS SDK for PHP. For more information on the AWS SDK for PHP, see http://aws.amazon.com/sdkforphp.
- You must be signed up for Amazon Simple Workflow Service (SWF). For more information, see http://aws.amazon.com/swf.
- Download aws-sdk-php code
- Replace folder
_samples/AmazonSimpleWorkflow/cron
by this repository folder - Config aws
CFCredentials
inconfig.inc.php
- Config your swf info in
_samples/AmazonSimpleWorkflow/cron/Config.php
- Create the your workflow domain,name,activity ... in Amazon Simple Workflow Service (SWF)
- To run this sample, you need to execute three scripts from the command line in separate terminal/console windows
-
Start the decider, which periodically schedules an activity task, using the command: php -f _samples/AmazonSimpleWorkflow/cron/workflow_decider_workers.php Once successfully started, the decider will start polling for decision tasks.
-
Start the activity worker to perform the tasks using the command: php -f _samples/AmazonSimpleWorkflow/cron/first_activity_workers.php Once successfully started, the activity worker will start polling for first activity tasks.
-
Start the activity worker to perform the tasks using the command: php -f _samples/AmazonSimpleWorkflow/cron/second_activity_workers.php Once successfully started, the activity worker will start polling for second activity tasks.
-
Start a workflow execution using the command: php -f _samples/AmazonSimpleWorkflow/cron/example_workflow_execute.php After an execution has been started, the decider and activity worker will start processing tasks.
-
The decider will print a message to the console each time it completes a decision task and the activity worker will print a message to the console each time it completes an activity task.
Note that the start_cron_example_workflow.php script will exit quickly while the decider and activity worker scripts keep running until you manually terminate them.