We would assume you know the basic recipe of cooking spaghetti, if not, it's a good oportunity for your next date!
Here is our application workflow representation :
- Cooking Spaghetti ( Workflow )
- Baking pasta ( Child Workflow )
- Hot watter ( Activity )
- Plunge pasta ( Activity )
- Secret sauce ( Child Workflow )
- Roast Oignons ( Activity )
- Tomato Sauce ( Activity )
- Compile pasta,sauce,parmesan ( Activity )
- Eat !! ( Activity )
$ composer require 'continuousphp/aws-swf'
We use PSR-4 autoloading for discover
Workflow
andActivity
class. But like SWF not support camelCase, we need enable classmap intocomposer.json
the filevendor/composer/autoload_classmap.php
is created during composer installation and help us to find class name much faster.
{
"autoload": {
"classmap": ["demo/"]
}
}
run composer dump-autoload
if dependencies already installed after your edition of composer.json.
$ServiceConfig = new Continuous\Swf\ServiceConfig(
'cphp-demo-0.1.0',
'myDemoServer',
$sdkAws->createClient('Swf'),
'Continuous\\Demo\\Swf'
);
In order to run our workflow Spaghetti demo, you need to have an AWS Account.
## Setup IAM
For security reason we recommand you to create a speficic user with appropriate ACL before run this demo.
- Connect to your AWS console and go into AWS IAM section.
- Create new user named
cphp-aws-swf-demo
with keys assigned. - Copy in your clipboard our policy
config/aws-policy.json
. - Create an
inline policy
underPermissions
tab on your user. - Select
Custom Policy
and past the json in Policy document and follow instruction.
Now you have an user with proper permission, you need create credential file dedicated to aws keys
# Use Makefile target for generate file
$ make aws-config
# Create yourself a file `.aws.conf` with your keys like this
aws.key=XXXX
aws.secret=XXX
Now our project are well setup, we are able to run phing
task for build
our Domain named cphp-demo
with our Spaghetti Workflow and Activities associates.
- Use Makefile for setup AWS SWF
$ make setup
- Use Phing directly
# prepare settings for phing task
./vendor/bin/phing -propertyfile .aws.conf build
# run AWS SWF setup process
./vendor/bin/phing -propertyfile .aws.conf init