Пример #1
0
        public TimerScheduling(ISchedulerStore <T> schedulerStore, SchedulerOptions schedulerOptions,
                               ILogger <TimerScheduling <T> > log, IClock clock)
        {
            this.schedulerStore   = schedulerStore;
            this.schedulerOptions = schedulerOptions;
            this.clock            = clock;

            this.log = log;
        }
Пример #2
0
        public TimerScheduler(ISchedulerStore <T> schedulerStore, SchedulerOptions schedulerOptions,
                              IClock clock, ISemanticLog log)
        {
            this.schedulerStore   = schedulerStore;
            this.schedulerOptions = schedulerOptions;

            actionBlock = new ActionBlock <SchedulerBatch <T> >(HandleAsync, new ExecutionDataflowBlockOptions
            {
                BoundedCapacity        = schedulerOptions.MaxParallelism * 4,
                MaxDegreeOfParallelism = schedulerOptions.MaxParallelism,
                MaxMessagesPerTask     = 1
            });

            this.clock = clock;

            this.log = log;
        }
Пример #3
0
        public TimerConsumer(ISchedulerStore <T> schedulerStore, SchedulerOptions schedulerOptions,
                             ScheduleSuccessCallback <T> onSuccess,
                             ScheduleErrorCallback <T> onError,
                             ILogger log, IClock clock)
        {
            this.schedulerStore   = schedulerStore;
            this.schedulerOptions = schedulerOptions;

            this.onSuccess = onSuccess;
            this.onError   = onError;

            activity = $"Scheduler.Query({schedulerOptions.QueueName})";

            actionBlock = new ActionBlock <SchedulerBatch <T> >(async batch =>
            {
                using (Telemetry.Activities.StartActivity(activity))
                {
                    try
                    {
                        await HandleAsync(batch);
                    }
                    catch (OperationCanceledException ex)
                    {
                        throw new AggregateException(ex);
                    }
                }
            }, new ExecutionDataflowBlockOptions
            {
                BoundedCapacity        = schedulerOptions.MaxParallelism * 4,
                MaxDegreeOfParallelism = schedulerOptions.MaxParallelism,
                MaxMessagesPerTask     = 1
            });

            this.clock = clock;

            this.log = log;
        }
Пример #4
0
 public MessageScheduler(ISchedulerStore schedulerStore)
 {
     _schedulerStore = schedulerStore;
 }