-
Notifications
You must be signed in to change notification settings - Fork 2
Schedule activities
Note: As of writing this document Guflow allows you to schedule activities and timer in workflow. Supports of child workflows and lambda are coming soon.
Workflows are generally where you write coordination logic and while in activity you carry out actual work. An activity can take anywhere between a second and days to complete its work. You can learn more about activity hosting and implementation in activity section.
In Guflow you can schedule the activity
public class TranscodeWorkflow : Workflow
{
public TranscodeWorkflow()
{
ScheduleActivity<DownloadActivity>();
}
}
For workflow to schedule DownloadActivity it must be registered with Amazon SWF. In above version workflow will extract out the activity information from DownloadActivity and schedule it with Amazon SWF when started.
Above API is good if you have access to activity however if for some reason you don't have access to activity class or your activity is implemented in other framework/language then you can directly provide scheduling information, as shown below:
public class TranscodeWorkflow : Workflow
{
public TranscodeWorkflow()
{
ScheduleActivity(name:"DownloadActivity", version: "1.0");
}
}
Guflow gives you full control in managing input and events of scheduling activities. Some of following examples will help you to understand the usage of scheduling APIs
//Following example will schedule the DownloadActivity with custom input.
public class TranscodeWorkflow : Workflow
{
public TranscodeWorkflow()
{
ScheduleActivity<DownloadActivity>().WithInput(a=>new {Location ="S3Bucket"});
}
}
//Following example will reschedule the activity on failure.
public class TranscodeWorkflow : Workflow
{
public TranscodeWorkflow()
{
ScheduleActivity<DownloadActivity>().WithInput(a=>new {Location ="S3Bucket"})
.OnFailure(Reschedule);
}
}
Both ScheduleActivity methods allow you to pass additional argument - "positional name", which you can use to schedule same activity at different places in a workflow.
You can schedule multiple activities or timer in sequence or in parallel in a workflow. When a workflow starts it will schedule the startup items (activities or timers). Startup items are those which does not have any parent items. Once a activity or timer is completed it will schedule its children.
Guflow
- Prerequisite
- Installation
-
Workflows
- Creating first workflow
- Registration
- Hosting
- Start workflow
- Schedule activities
- Schedule timers
- Schedule lambda function
- Schedule child workflows
- Lambda functions vs activities
- Workflow input
- Workflow actions
- Signals
- Workflow branches
- Deflow algorithm
- Workflow events
- Query APIs
- Custom polling strategy
- Things to take care of
- Activites
- Unit testing
- Performance & scalability
- Error handling
- Logging
- Debugging
- Tutorial
- Release notes