-
Notifications
You must be signed in to change notification settings - Fork 2
Return ad hoc workflow action
Gurmit Teotia edited this page Nov 17, 2022
·
10 revisions
On receiving a signal you can interrupt the workflow execution or schedule any workflow item. You need to define the signal event handler as explained here.
In the following example workflow is cancelled on receiving the "CancelOrder" signal if the order is cancelled within grace period:
public class OrderWorkflow :Workflow
{
public OrderWorkflow()
{
ScheduleTimer("GracePeriod").FireAfter(TimeSpan.FromHours(1));
ScheduleLambda("ReserveOrder").AfterTimer("GracePeriod");
ScheduleLambda("OrderCancelled").AfterTimer("GracePeriod").When(_=>false);
ScheduleLambda("ShipOrder").AfterLambda("ReserveOrder");
}
[SignalEvent]
public WorkflowAction CancelOrder()
{
var timer = Timer("GracePeriod");
if timer.IsActive()
return CancelRequest.For(timer) + Jump.ToLambda("OrderCancelled");
return Ignore;
}
}
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