jsalcedo09 / aws-swf-laravel

A Laravel 5 package to integrate with Amazon Simplified Workflows Service
MIT License
2 stars 1 forks source link

Laravel-Amazon-SWF

A Laravel 5 package to integrate with Amazon Simplified Workflows Service

Installation

  1. Add respository in composer.json

    "repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/jsalcedo09/aws-swf-laravel"
    }
    ]
  2. Add as dependency in require block

    "require": {
    "jsalcedo09/aws-swf-laravel": "dev-master"
    }
  3. On the app/app.php add

'providers' => [
...
    Jsalcedo09\SwfWorkflows\SwfWorkflowsServiceProvider::class
]

Commands

Copy configuration files activityworkflow.php & swfworkflows.php in config folder

Workflow config structure

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"
                ]
        ]],
];

Activityflow config structure

activity flow can be configured in activityworkflow.php

**Note : To be identify the child workflow name it's necessary to input it in ['childWorkFlowData']['workflowType']

Decider event structure

'event_type' can be any swf events (WorkflowExecutionStarted, DecisionTaskScheduled etc.) for example TestDomain.TestWorkflowWithDecider.decider.WorkflowExecutionStarted

Activity event structure

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.