Beispiel #1
0
 public BatchFactory(TimerQueueProvider batchQueueProvider,
                     IDispatcherPlugin plugin,
                     BatchConfigProvider config,
                     IQueueEvent queueEvent,
                     LocalQueueProvider queueManager)
 {
     _batchQueueProvider = batchQueueProvider;
     _plugin             = plugin;
     _config             = config;
     _queueEvent         = queueEvent;
     _localQueue         = queueManager;
 }
Beispiel #2
0
 internal BatchToken(LocalQueueProvider queue,
                     TimerQueueProvider timeQueueProvider,
                     IQueueEvent queueEvent,
                     ManualResetEventSlim manualResetEventSlim,
                     BatchConfigProvider batchConfig)
 {
     _cancellationTokenSource = new CancellationTokenSource();
     _queue = queue;
     _timerQueueProvider  = timeQueueProvider;
     _queueEvent          = queueEvent;
     _triggerAllCompleted = manualResetEventSlim;
     _batchConfig         = batchConfig;
 }
Beispiel #3
0
        public static IBatchFactory Batch(this IDispatcherPlugin dispatcherPlugin, Action <IBatchQueueBuilder> action)
        {
            var config = new Dictionary <Type, BatchConfig>();

            var builder = new BatchQueueBuilder(config);

            action(builder);

            var batchConfigProvider = new BatchConfigProvider(config);

            var queueProvider = new LocalQueueBuilder(batchConfigProvider).Build();

            IQueueEvent queueEvent = new QueueEventBasic();

            if (batchConfigProvider.Find(p => p.Value.TriggerCount > 0).Any())
            {
                queueEvent = new QueueEventUnique(batchConfigProvider, queueEvent);
            }

            var batchProvider = new TimerQueueProvider(batchConfigProvider, queueEvent, queueProvider);

            return(new BatchFactory(batchProvider, dispatcherPlugin, batchConfigProvider, queueEvent, queueProvider));
        }