Пример #1
0
        public BatchPublisher(ChannelExecutor executor, IModel model, BatchSettings settings, PendingConfirmationCollection confirmations)
        {
            _executor      = executor;
            _model         = model;
            _settings      = settings;
            _confirmations = confirmations;

            _immediatePublisher = new ImmediatePublisher(executor, model, confirmations);

            var channelOptions = new BoundedChannelOptions(settings.MessageLimit)
            {
                AllowSynchronousContinuations = false,
                FullMode     = BoundedChannelFullMode.Wait,
                SingleReader = true,
                SingleWriter = false
            };

            _publishChannel = Channel.CreateBounded <BatchPublish>(channelOptions);
            _publishTask    = Task.Run(WaitForBatch);
        }
Пример #2
0
 public ImmediatePublisher(ChannelExecutor executor, IModel model, PendingConfirmationCollection confirmations)
 {
     _executor      = executor;
     _model         = model;
     _confirmations = confirmations;
 }