A Laravel 5 package to integrate with Amazon Simplified Workflows Service
Add respository in composer.json
"repositories": [
{
"type": "vcs",
"url": "https://github.com/jsalcedo09/aws-swf-laravel"
}
]
Add as dependency in require block
"require": {
"jsalcedo09/aws-swf-laravel": "dev-master"
}
On the app/app.php
add
'providers' => [
...
Jsalcedo09\SwfWorkflows\SwfWorkflowsServiceProvider::class
]
php artisan vendor:publish
Copy configuration files activityworkflow.php & swfworkflows.php in config folder
Run Decider task
php artisan swfworkflows:decider <domain> <tasklist>
Run Activity task
php artisan swfworkflows:activity <domain> <tasklist>
Register workflows and activities to SWF
php artisan swfworkflows:register all|domains|workflows|activities
workflows can be configured in swfworkflows.php
return [
"workflowExecutionRetentionPeriodInDays" => "90",
'activities'=>[[
"domain" => "TestDomain",
"name" => "Activity1",
"version" => "1",
'defaultTaskScheduleToCloseTimeout' => '31536000',
'defaultTaskScheduleToStartTimeout' => '31536000',
'defaultTaskStartToCloseTimeout' => '31536000',
'defaultTaskHeartbeatTimeout' => '1500',
"defaultTaskList"=>[
"name"=>"default"
],
"domain" => "TestDomain",
"name" => "Activity2",
"version" => "1",
'defaultTaskScheduleToCloseTimeout' => '31536000',
'defaultTaskScheduleToStartTimeout' => '31536000',
'defaultTaskStartToCloseTimeout' => '31536000',
'defaultTaskHeartbeatTimeout' => '1500',
"defaultTaskList"=>[
"name"=>"default"
]
]],
'workflows' => [[
"domain" => "TestDomain",
"name" => "TestWorkflowWithDecider",
"version" => "1",
"defaultExecutionStartToCloseTimeout" => "31536000",
"defaultTaskStartToCloseTimout" => "31536000",
"defaultChildPolicy" => "TERMINATE",
"defaultTaskList"=>[
"name"=>"default"
]
]],
];
activity flow can be configured in activityworkflow.php
Basic flow scenario with 'start' and 'finish' flags
return [
'workflows' => [
'TestWorkflowWithDecider' => [
'start'=>'Activity1',
'Activity1'=>'Activity2',
'Activity2'=>'finish'
]
]
];
Pause workflow scenario with 'wait' flag
return [
'workflows' => [
'TestWorkflowWithDecider' => [
'start'=>'Activity1',
'Activity1'=>'wait',
'Activity1-wait'=>'Activity2',
'Activity2'=>'finish'
]
]
];
Child workflow scenario
return [
'workflows' => [
'TestWorkflowWithDecider' => [
'start'=>'Activity1',
'Activity1'=>'startChildWorkflow',
'ChildWait'=>['ChildWait','finish'=>'Activity2'],
'Activity2'=>'finish'
],
'ChildTestWorkflowWithDecider' => [
'start'=>'Activity1',
'Activity1'=>'Activity2',
'Activity2'=>'finish'
]
],
'childWorkflows' => [
'GenerateBannerWorkflowTest'
]
];
**Note : To be identify the child workflow name it's necessary to input it in ['childWorkFlowData']['workflowType']
'event_type' can be any swf events (WorkflowExecutionStarted, DecisionTaskScheduled etc.) for example TestDomain.TestWorkflowWithDecider.decider.WorkflowExecutionStarted
for example TestDomain.activity.TestWorkflowWithDeciderActivity1
Note : It's developer responsibility to build listener to listen for those events. This library provider some useful methods to build the flow.