示例#1
0
        /// <summary>
        /// For internal use only.
        /// </summary>
        /// <param name="allHistoryEvents"></param>
        /// <param name="startedEventId"></param>
        /// <param name="scheduledEventId"></param>
        protected void PopulateActivityFrom(IEnumerable <HistoryEvent> allHistoryEvents, long startedEventId, long scheduledEventId)
        {
            bool foundActivityScheduledEvent = false;

            _startedEventId   = startedEventId;
            _scheduledEventId = scheduledEventId;
            foreach (var historyEvent in allHistoryEvents)
            {
                if (historyEvent.IsActivityStartedEventFor(startedEventId))
                {
                    WorkerIdentity = historyEvent.ActivityTaskStartedEventAttributes.Identity;
                }
                else if (historyEvent.IsActivityScheduledEventFor(scheduledEventId))
                {
                    _activityName           = historyEvent.ActivityTaskScheduledEventAttributes.ActivityType.Name;
                    _activityVersion        = historyEvent.ActivityTaskScheduledEventAttributes.ActivityType.Version;
                    _activityPositionalName = historyEvent.ActivityTaskScheduledEventAttributes.Control.FromJson <ActivityScheduleData>().PN;
                    AwsIdentity             = AwsIdentity.Raw(historyEvent.ActivityTaskScheduledEventAttributes.ActivityId);
                    Input = historyEvent.ActivityTaskScheduledEventAttributes.Input;
                    foundActivityScheduledEvent = true;
                }
            }
            if (!foundActivityScheduledEvent)
            {
                throw new IncompleteEventGraphException(string.Format("Can not found activity scheduled event id {0}.", scheduledEventId));
            }
        }
示例#2
0
        protected void PopulateProperties(long timerStartedEventId, IEnumerable <HistoryEvent> allHistoryEvents)
        {
            bool foundTimerStartedEvent = false;

            _timerStartedEventId = timerStartedEventId;
            foreach (var historyEvent in allHistoryEvents)
            {
                if (historyEvent.IsTimerStartedEventFor(timerStartedEventId))
                {
                    _firedAfter = TimeSpan.FromSeconds(int.Parse(historyEvent.TimerStartedEventAttributes.StartToFireTimeout));
                    AwsIdentity = AwsIdentity.Raw(historyEvent.TimerStartedEventAttributes.TimerId);
                    var timerScheduleData = historyEvent.TimerStartedEventAttributes.Control.FromJson <TimerScheduleData>();
                    IsARescheduledTimer    = timerScheduleData.IsARescheduleTimer;
                    _timerName             = timerScheduleData.TimerName;
                    foundTimerStartedEvent = true;
                    break;
                }
            }
            if (!foundTimerStartedEvent)
            {
                throw new IncompleteEventGraphException(string.Format("Can not find the timer started event id {0}", timerStartedEventId));
            }
        }
 internal TimerStartFailedEvent(HistoryEvent startTimerFailedEvent) : base(startTimerFailedEvent.EventId)
 {
     _startTimerFailedAttributes = startTimerFailedEvent.StartTimerFailedEventAttributes;
     AwsIdentity = AwsIdentity.Raw(_startTimerFailedAttributes.TimerId);
 }
示例#4
0
 internal ActivitySchedulingFailedEvent(HistoryEvent schedulingFailedEvent) : base(schedulingFailedEvent.EventId)
 {
     _eventAttributes = schedulingFailedEvent.ScheduleActivityTaskFailedEventAttributes;
     AwsIdentity      = AwsIdentity.Raw(_eventAttributes.ActivityId);
 }
示例#5
0
 public bool Has(AwsIdentity identity)
 {
     return(Identity.Id == identity);
 }
 internal TimerCancellationFailedEvent(HistoryEvent timerCancellationFailedEvent) : base(timerCancellationFailedEvent.EventId)
 {
     _eventAttributes = timerCancellationFailedEvent.CancelTimerFailedEventAttributes;
     AwsIdentity      = AwsIdentity.Raw(_eventAttributes.TimerId);
 }
 internal ActivityCancellationFailedEvent(HistoryEvent activityCancellationFailedEvent) : base(activityCancellationFailedEvent.EventId)
 {
     _eventAttributes = activityCancellationFailedEvent.RequestCancelActivityTaskFailedEventAttributes;
     AwsIdentity      = AwsIdentity.Raw(_eventAttributes.ActivityId);
 }
 internal ActivityCancelRequestedEvent(HistoryEvent activityCancelRequestedEvent) : base(activityCancelRequestedEvent.EventId)
 {
     _cancelRequestedEventId = activityCancelRequestedEvent.EventId;
     AwsIdentity             = AwsIdentity.Raw(activityCancelRequestedEvent.ActivityTaskCancelRequestedEventAttributes.ActivityId);
     IsActive = true;
 }