Пример #1
0
        public HyperNodeActivityObserver(HyperNodeServiceActivityMonitor underlyingMonitor, IObservable <IHyperNodeActivityEventItem> activityEventStream, IScheduler scheduler, HyperNodeTaskInfo taskInfo)
        {
            _underlyingMonitor = underlyingMonitor;
            _activity          = taskInfo.Activity;
            _scheduler         = scheduler;
            _subscription      = activityEventStream
                                 .Where(
                e =>
            {
                var shouldTrack = false;

                try
                {
                    // ...for activity items matching the specified criteria
                    shouldTrack = underlyingMonitor.ShouldTrack(e);
                }
                catch (Exception ex)
                {
                    // This is legal at this point because we already subscribed our cache and task trace monitors earlier
                    _activity.TrackException(
                        new ActivityMonitorException(
                            $"Unable to subscribe activity monitor '{underlyingMonitor.Name}' because its {nameof(HyperNodeServiceActivityMonitor.ShouldTrack)}() method threw an exception.",
                            ex
                            )
                        );
                }

                return(shouldTrack);
            }
                ).TakeUntil(taskInfo.TerminatingSequence)
                                 .ObserveOn(scheduler)
                                 .SubscribeSafe(this);
        }
Пример #2
0
 public TaskCompletedEventArgs(ITaskActivityTracker activity, ITaskEventContext taskContext, IReadOnlyHyperNodeResponseInfo responseInfo)
     : base(activity, taskContext)
 {
     ResponseInfo = responseInfo;
 }
Пример #3
0
 public TaskStartedEventArgs(ITaskActivityTracker activity, ITaskEventContext taskContext, Action cancelTaskAction)
     : base(activity, taskContext)
 {
     _cancelTaskAction = cancelTaskAction;
 }
Пример #4
0
 public HyperNodeEventArgs(ITaskActivityTracker activity, ITaskEventContext taskContext)
 {
     Activity    = activity;
     TaskContext = taskContext;
 }
Пример #5
0
 public MessageReceivedEventArgs(ITaskActivityTracker activity, ITaskEventContext taskContext, Action <string> rejectMessageAction)
     : base(activity, taskContext)
 {
     _rejectMessageAction = rejectMessageAction;
 }