/// <summary> /// Internal method. Library user should not care about it. /// </summary> /// <param name="runid"></param> /// <param name="initiatedEventId"></param> /// <param name="allEvents"></param> protected void PopulateProperties(string runid, long initiatedEventId, IEnumerable <HistoryEvent> allEvents) { RunId = runid; _initiatedEventId = initiatedEventId; bool foundEvent = false; foreach (var historyEvent in allEvents) { if (historyEvent.IsChildWorkflowInitiatedEvent(initiatedEventId)) { var attr = historyEvent.StartChildWorkflowExecutionInitiatedEventAttributes; Input = attr.Input; WorkflowId = attr.WorkflowId; ScheduleId = ScheduleId.Raw(attr.WorkflowId); WorkflowName = attr.WorkflowType.Name; WorkflowVersion = attr.WorkflowType.Version; PositionalName = attr.Control.As <ScheduleData>().PN; foundEvent = true; break; } } if (!foundEvent) { throw new IncompleteEventGraphException($"Can not find Child Workflow InitiatedEvent for id {initiatedEventId}"); } }
/// <summary> /// For internal use only. /// </summary> /// <param name="allHistoryEvents"></param> /// <param name="startedEventId"></param> /// <param name="scheduledEventId"></param> protected void PopulateAttributes(IEnumerable <HistoryEvent> allHistoryEvents, long startedEventId, long scheduledEventId) { bool foundActivityScheduledEvent = false; _startedEventId = startedEventId; _scheduledEventId = scheduledEventId; foreach (var historyEvent in allHistoryEvents) { if (historyEvent.IsActivityStartedEvent(startedEventId)) { WorkerIdentity = historyEvent.ActivityTaskStartedEventAttributes.Identity; } else if (historyEvent.IsActivityScheduledEvent(scheduledEventId)) { var attr = historyEvent.ActivityTaskScheduledEventAttributes; _activityName = attr.ActivityType.Name; _activityVersion = attr.ActivityType.Version; _activityPositionalName = attr.Control.As <ScheduleData>().PN; ScheduleId = ScheduleId.Raw(attr.ActivityId); Input = attr.Input; foundActivityScheduledEvent = true; } } if (!foundActivityScheduledEvent) { throw new IncompleteEventGraphException(string.Format("Can not found activity scheduled event id {0}.", scheduledEventId)); } }
internal ExternalWorkflowCancellationRequestedEvent(HistoryEvent cancelRequested) : base(cancelRequested) { var attr = cancelRequested.ExternalWorkflowExecutionCancelRequestedEventAttributes; ScheduleId = ScheduleId.Raw(attr.WorkflowExecution.WorkflowId); }
public WorkflowItemSignalTimedoutEvent(HistoryEvent historyEvent) : base(historyEvent) { var attr = historyEvent.MarkerRecordedEventAttributes; _details = attr.Details.As <SignalsTimedoutDetails>(); ScheduleId = ScheduleId.Raw(_details.ScheduleId); }
public WaitForSignalsEvent(HistoryEvent @event, IEnumerable <HistoryEvent> allEvents) : base(@event) { _data = @event.MarkerRecordedEventAttributes.Details.As <WaitForSignalData>(); ScheduleId = ScheduleId.Raw(_data.ScheduleId); _signalState = new WaitingForSignalState(this); PopulateResumedSignals(allEvents); }
internal LambdaSchedulingFailedEvent(HistoryEvent failedEvent) : base(failedEvent) { var attr = failedEvent.ScheduleLambdaFunctionFailedEventAttributes; ScheduleId = ScheduleId.Raw(attr.Id); Cause = attr.Cause?.Value; }
protected void PopulateProperties(long scheduledEventId, IEnumerable <HistoryEvent> eventGraph) { _scheduledEventId = scheduledEventId; foreach (var historyEvent in eventGraph) { if (historyEvent.IsLambdaScheduledEvent(scheduledEventId)) { var attr = historyEvent.LambdaFunctionScheduledEventAttributes; Input = attr.Input; _name = attr.Name; _positionalName = attr.Control.As <ScheduleData>().PN; ScheduleId = ScheduleId.Raw(historyEvent.LambdaFunctionScheduledEventAttributes.Id); if (!string.IsNullOrEmpty(attr.StartToCloseTimeout)) { Timeout = TimeSpan.FromSeconds(Double.Parse(attr.StartToCloseTimeout)); } break; } } if (ScheduleId == null) { throw new IncompleteEventGraphException($"Can not find lambda scheduled event for id {scheduledEventId}."); } }
protected void PopulateProperties(long timerStartedEventId, IEnumerable <HistoryEvent> allHistoryEvents) { bool foundTimerStartedEvent = false; _timerStartedEventId = timerStartedEventId; foreach (var historyEvent in allHistoryEvents) { if (historyEvent.IsTimerStartedEvent(timerStartedEventId)) { _timeout = TimeSpan.FromSeconds(int.Parse(historyEvent.TimerStartedEventAttributes.StartToFireTimeout)); ScheduleId = ScheduleId.Raw(historyEvent.TimerStartedEventAttributes.TimerId); var timerScheduleData = historyEvent.TimerStartedEventAttributes.Control.As <TimerScheduleData>(); TimerType = timerScheduleData.TimerType; _timerName = timerScheduleData.TimerName; SignalTriggerEventId = timerScheduleData.SignalTriggerEventId; foundTimerStartedEvent = true; break; } } if (!foundTimerStartedEvent) { throw new IncompleteEventGraphException(string.Format("Can not find the timer started event id {0}", timerStartedEventId)); } }
public WaitForSignalsDecision(WaitForSignalData data) : base(false) { _data = data; _id = ScheduleId.Raw(data.ScheduleId); }
internal ActivityCancellationFailedEvent(HistoryEvent activityCancellationFailedEvent) : base(activityCancellationFailedEvent) { _eventAttributes = activityCancellationFailedEvent.RequestCancelActivityTaskFailedEventAttributes; ScheduleId = ScheduleId.Raw(_eventAttributes.ActivityId); }
internal ActivitySchedulingFailedEvent(HistoryEvent schedulingFailedEvent) : base(schedulingFailedEvent) { _eventAttributes = schedulingFailedEvent.ScheduleActivityTaskFailedEventAttributes; ScheduleId = ScheduleId.Raw(_eventAttributes.ActivityId); }
public WorkflowDecision RecordSignal(WorkflowSignaledEvent signal) { _signalState.RecordSignal(signal.SignalName); SignalReceived?.Invoke(this, signal.SignalName); return(new WorkflowItemSignalledDecision(ScheduleId.Raw(_data.ScheduleId), _data.TriggerEventId, signal.SignalName, signal.EventId)); }
public WorkflowItemSignalledEvent(HistoryEvent @event) : base(@event) { _data = @event.MarkerRecordedEventAttributes.Details.As <WorkflowItemSignalledData>(); ScheduleId = ScheduleId.Raw(_data.ScheduleId); }
internal TimerStartFailedEvent(HistoryEvent startTimerFailedEvent) : base(startTimerFailedEvent) { _startTimerFailedAttributes = startTimerFailedEvent.StartTimerFailedEventAttributes; ScheduleId = ScheduleId.Raw(_startTimerFailedAttributes.TimerId); }
internal TimerCancellationFailedEvent(HistoryEvent timerCancellationFailedEvent) : base(timerCancellationFailedEvent) { _eventAttributes = timerCancellationFailedEvent.CancelTimerFailedEventAttributes; ScheduleId = ScheduleId.Raw(_eventAttributes.TimerId); }
internal ActivityCancelRequestedEvent(HistoryEvent activityCancelRequestedEvent) : base(activityCancelRequestedEvent) { ScheduleId = ScheduleId.Raw(activityCancelRequestedEvent.ActivityTaskCancelRequestedEventAttributes.ActivityId); }
internal ExternalWorkflowCancelRequestFailedEvent(HistoryEvent cancelRequestFailedEvent) : base(cancelRequestFailedEvent) { _eventAttributes = cancelRequestFailedEvent.RequestCancelExternalWorkflowExecutionFailedEventAttributes; ScheduleId = ScheduleId.Raw(_eventAttributes.WorkflowId); }