public RabbitMQProducer(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _logger = _serviceProvider.GetService <ILogger <RabbitMQProducer> >(); _options = _serviceProvider.GetService <RabbitMQMessageBusOptions>(); _connection = _serviceProvider.GetService <IConnection>(); _channel = _connection.CreateModel(); if (_options.ConfirmSelect) { _channel.ConfirmSelect(); } for (int i = 0; i < _options.ChannelPoolSize; i++) { var channel = _connection.CreateModel(); if (_options.ConfirmSelect) { channel.ConfirmSelect(); } _channelPool.AddObject(new ChannelScope(_channelPool, channel)); } }
public RabbitMQConsumer(IServiceProvider serviceProvider, IRabbitMQProducer producer) { _serviceProvider = serviceProvider; _producer = producer; _logger = serviceProvider.GetService <ILogger <RabbitMQConsumer> >(); _options = serviceProvider.GetService <RabbitMQMessageBusOptions>(); _connection = _serviceProvider.GetService <IConnection>(); _channel = _connection.CreateModel(); _channel.ModelShutdown += _channel_ModelShutdown; _autoAck = _options.AutoAck; }
public RabbitMQDelayConsumer(IServiceProvider serviceProvider, IRabbitMQProducer producer) { _serviceProvider = serviceProvider; _producer = producer; _logger = serviceProvider.GetService <ILogger <RabbitMQDelayConsumer> >(); _options = serviceProvider.GetService <RabbitMQMessageBusOptions>(); _connection = _serviceProvider.GetService <IConnection>(); _channel = _connection.CreateModel(); _autoAck = false; // _options.AutoAck; ManualCommitBatch = 1; // _options.ManualCommitBatch; }