public override IEnumerable <WorkflowItemEvent> AllEvents(bool includeRescheduleTimerEvents = false) { var childWorkflowItems = WorkflowHistoryEvents.AllChildWorkflowEvents(this); var timerEvents = Enumerable.Empty <WorkflowItemEvent>(); if (includeRescheduleTimerEvents) { timerEvents = WorkflowHistoryEvents.AllTimerEvents(RescheduleTimer, true); } return(childWorkflowItems.Concat(timerEvents).OrderByDescending(i => i, WorkflowEvent.IdComparer)); }
private async Task ExecuteTasks(WorkflowHost workflowHost, CancellationToken cancellationToken) { var workflowType = _decisionTask.WorkflowType; var workflow = workflowHost.Workflow(workflowType.Name, workflowType.Version); var historyEvents = new WorkflowHistoryEvents(this); var decisions = Perform(() => workflow.Decisions(historyEvents)); await workflowHost.SendDecisionsAsync(_decisionTask.TaskToken, decisions); RaisePostExecutionEvents(decisions, workflow); }
private void InitializeDefault(IWorkflow workflow) { _input = (item) => WorkflowHistoryEvents.WorkflowStartedEvent().Input; _timeout = item => null; _completedAction = e => e.DefaultAction(workflow); _failedAction = e => e.DefaultAction(workflow); _timedoutAction = e => e.DefaultAction(workflow); _schedulingFailedAction = e => e.DefaultAction(workflow); _startFailedAction = e => e.DefaultAction(workflow); _onFalseTrigger = _ => IsStartupItem() ? WorkflowAction.Empty : new TriggerActions(this).FirstJoint(); }
public override IEnumerable <WorkflowDecision> CancelDecisions() { var lastEvent = LastEvent(true); var latestTimerEvent = WorkflowHistoryEvents.LastTimerEvent(RescheduleTimer, true); if (latestTimerEvent != null && lastEvent == latestTimerEvent) { return(RescheduleTimer.CancelDecisions()); } return(new[] { new CancelRequestWorkflowDecision(ScheduleId, (lastEvent as ChildWorkflowEvent)?.RunId), }); }
public override WorkflowDecision GetCancelDecision() { var lastEvent = LastEvent; var latestTimerEvent = WorkflowHistoryEvents.LastTimerEventFor(_rescheduleTimer); if (latestTimerEvent != null && lastEvent == latestTimerEvent) { return(_rescheduleTimer.GetCancelDecision()); } return(new CancelActivityDecision(Identity)); }
public override IEnumerable <WorkflowDecision> CancelDecisions() { var lastEvent = LastEvent(true); var latestTimerEvent = WorkflowHistoryEvents.LastTimerEvent(RescheduleTimer, true); if (latestTimerEvent != null && lastEvent == latestTimerEvent) { return(RescheduleTimer.CancelDecisions()); } return(new [] { new CancelActivityDecision(ScheduleId) }); }
private async Task ExecuteTasks(WorkflowHost workflowHost, CancellationToken cancellationToken) { var workflowType = _decisionTask.WorkflowType; var workflow = workflowHost.FindBy(workflowType.Name, workflowType.Version); var historyEvents = new WorkflowHistoryEvents(_decisionTask.Events, _decisionTask.PreviousStartedEventId + 1, _decisionTask.StartedEventId); using (var execution = workflow.NewExecutionFor(historyEvents)) { var decisions = Perform(execution); await workflowHost.SendDecisionsAsync(_decisionTask.TaskToken, decisions); RaisePostExecutionEvents(decisions, workflow); } }
public override WorkflowItemEvent LastEvent(bool includeRescheduleTimerEvents = false) { var lastEvent = WorkflowHistoryEvents.LastChildWorkflowEvent(this); WorkflowItemEvent timerEvent = null; if (includeRescheduleTimerEvents) { timerEvent = WorkflowHistoryEvents.LastTimerEvent(RescheduleTimer, true); } if (lastEvent > timerEvent) { return(lastEvent); } return(timerEvent); }
internal ActivityItem(Identity identity, IWorkflow workflow) : base(identity, workflow) { _onCompletionAction = c => c.DefaultAction(workflow); _onFailedAction = c => c.DefaultAction(workflow); _onTimedoutAction = t => t.DefaultAction(workflow); _onCancelledAction = c => c.DefaultAction(workflow); _onCancellationFailedAction = c => c.DefaultAction(workflow); _onFailedSchedulingAction = c => c.DefaultAction(workflow); _inputFunc = a => WorkflowHistoryEvents.WorkflowStartedEvent().Input; _taskListFunc = a => null; _whenFunc = a => true; _onFalseAction = _ => IsStartupItem() ? WorkflowAction.Empty : new TriggerActions(this).FirstJoint(); _priorityFunc = a => null; _timeoutsFunc = a => new ActivityTimeouts(); }
public override WorkflowItemEvent LastEvent(bool includeRescheduleTimerEvents = false) { var latestActivityEvent = WorkflowHistoryEvents.LastActivityEvent(this); WorkflowItemEvent latestTimerEvent = null; if (includeRescheduleTimerEvents) { latestTimerEvent = WorkflowHistoryEvents.LastTimerEvent(RescheduleTimer, true); } if (latestActivityEvent > latestTimerEvent) { return(latestActivityEvent); } return(latestTimerEvent); }
public override IEnumerable <WorkflowItemEvent> AllEvents(bool includeRescheduleTimerEvents = false) => WorkflowHistoryEvents.AllTimerEvents(this, includeRescheduleTimerEvents);
public override WorkflowItemEvent LastEvent(bool includeRescheduleTimerEvents = false) => WorkflowHistoryEvents.LastTimerEvent(this, includeRescheduleTimerEvents);