コード例 #1
0
        /// <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}");
            }
        }
コード例 #2
0
        /// <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);
        }
コード例 #4
0
        public WorkflowItemSignalTimedoutEvent(HistoryEvent historyEvent) : base(historyEvent)
        {
            var attr = historyEvent.MarkerRecordedEventAttributes;

            _details   = attr.Details.As <SignalsTimedoutDetails>();
            ScheduleId = ScheduleId.Raw(_details.ScheduleId);
        }
コード例 #5
0
 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);
 }
コード例 #6
0
        internal LambdaSchedulingFailedEvent(HistoryEvent failedEvent)
            : base(failedEvent)
        {
            var attr = failedEvent.ScheduleLambdaFunctionFailedEventAttributes;

            ScheduleId = ScheduleId.Raw(attr.Id);
            Cause      = attr.Cause?.Value;
        }
コード例 #7
0
ファイル: LambdaEvent.cs プロジェクト: gurmitteotia/guflow
 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}.");
     }
 }
コード例 #8
0
ファイル: TimerEvent.cs プロジェクト: gurmitteotia/guflow
        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));
            }
        }
コード例 #9
0
 public WaitForSignalsDecision(WaitForSignalData data) : base(false)
 {
     _data = data;
     _id   = ScheduleId.Raw(data.ScheduleId);
 }
コード例 #10
0
 internal ActivityCancellationFailedEvent(HistoryEvent activityCancellationFailedEvent)
     : base(activityCancellationFailedEvent)
 {
     _eventAttributes = activityCancellationFailedEvent.RequestCancelActivityTaskFailedEventAttributes;
     ScheduleId       = ScheduleId.Raw(_eventAttributes.ActivityId);
 }
コード例 #11
0
 internal ActivitySchedulingFailedEvent(HistoryEvent schedulingFailedEvent)
     : base(schedulingFailedEvent)
 {
     _eventAttributes = schedulingFailedEvent.ScheduleActivityTaskFailedEventAttributes;
     ScheduleId       = ScheduleId.Raw(_eventAttributes.ActivityId);
 }
コード例 #12
0
 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));
 }
コード例 #13
0
 public WorkflowItemSignalledEvent(HistoryEvent @event)
     : base(@event)
 {
     _data      = @event.MarkerRecordedEventAttributes.Details.As <WorkflowItemSignalledData>();
     ScheduleId = ScheduleId.Raw(_data.ScheduleId);
 }
コード例 #14
0
 internal TimerStartFailedEvent(HistoryEvent startTimerFailedEvent)
     : base(startTimerFailedEvent)
 {
     _startTimerFailedAttributes = startTimerFailedEvent.StartTimerFailedEventAttributes;
     ScheduleId = ScheduleId.Raw(_startTimerFailedAttributes.TimerId);
 }
コード例 #15
0
 internal TimerCancellationFailedEvent(HistoryEvent timerCancellationFailedEvent)
     : base(timerCancellationFailedEvent)
 {
     _eventAttributes = timerCancellationFailedEvent.CancelTimerFailedEventAttributes;
     ScheduleId       = ScheduleId.Raw(_eventAttributes.TimerId);
 }
コード例 #16
0
 internal ActivityCancelRequestedEvent(HistoryEvent activityCancelRequestedEvent)
     : base(activityCancelRequestedEvent)
 {
     ScheduleId = ScheduleId.Raw(activityCancelRequestedEvent.ActivityTaskCancelRequestedEventAttributes.ActivityId);
 }
コード例 #17
0
 internal ExternalWorkflowCancelRequestFailedEvent(HistoryEvent cancelRequestFailedEvent)
     : base(cancelRequestFailedEvent)
 {
     _eventAttributes = cancelRequestFailedEvent.RequestCancelExternalWorkflowExecutionFailedEventAttributes;
     ScheduleId       = ScheduleId.Raw(_eventAttributes.WorkflowId);
 }