Ejemplo n.º 1
0
 public BatchFactory(TimerQueueProvider batchQueueProvider,
                     IDispatcherPlugin plugin,
                     BatchConfigProvider config,
                     IQueueEvent queueEvent,
                     LocalQueueProvider queueManager)
 {
     _batchQueueProvider = batchQueueProvider;
     _plugin             = plugin;
     _config             = config;
     _queueEvent         = queueEvent;
     _localQueue         = queueManager;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
 public LocalQueueBuilder(BatchConfigProvider config)
 {
     _config = config;
 }
 public LocalQueueProvider(ConcurrentDictionary <Type, ConcurrentQueue <object> > queue, BatchConfigProvider config)
 {
     _queue  = queue;
     _config = config;
 }
Ejemplo n.º 6
0
 public TimerQueueProvider(BatchConfigProvider config, IQueueEvent queueEvent, LocalQueueProvider localQueueProvider)
 {
     _config             = config;
     _queueEvent         = queueEvent;
     _localQueueProvider = localQueueProvider;
 }