public static TimerItem New(Identity identity, IWorkflow workflow) { var timerItem = new TimerItem(identity, workflow); timerItem._rescheduleTimer = Reschedule(timerItem, identity, workflow); timerItem.OnStartFailure(e => e.DefaultAction(workflow)); timerItem.OnCancelled(e => e.DefaultAction(workflow)); timerItem.OnFailedCancellation(e => e.DefaultAction(workflow)); timerItem.OnFired(e => e.DefaultAction(workflow)); return(timerItem); }
public static TimerItem Reschedule(WorkflowItem ownerItem, Identity identity, IWorkflow workflow) { var timerItem = new TimerItem(identity, workflow); timerItem._rescheduleTimer = timerItem; timerItem.OnStartFailure(e => WorkflowAction.FailWorkflow("RESCHEDULE_TIMER_START_FAILED", e.Cause)); timerItem.OnCancelled(e => WorkflowAction.CancelWorkflow("RESCHEDULE_TIMER_CANCELLED")); timerItem.OnFailedCancellation(e => WorkflowAction.FailWorkflow("RESCHEDULE_TIMER_CANCELLATION_FAILED", e.Cause)); timerItem.OnFired(e => WorkflowAction.Schedule(ownerItem)); return(timerItem); }