public RawMessagePublisher( [NotNull] string name, [NotNull] ILogFactory logFactory, [NotNull] IPublisherBuffer buffer, [NotNull] IRabbitMqPublishStrategy publishStrategy, [NotNull] RabbitMqSubscriptionSettings settings, bool publishSynchronously, bool submitTelemetry) { if (logFactory == null) { throw new ArgumentNullException(nameof(logFactory)); } Name = name ?? throw new ArgumentNullException(nameof(name)); _buffer = buffer ?? throw new ArgumentNullException(nameof(buffer)); _settings = settings ?? throw new ArgumentNullException(nameof(settings)); _publishSynchronously = publishSynchronously; _publishStrategy = publishStrategy ?? throw new ArgumentNullException(nameof(publishStrategy)); _submitTelemetry = submitTelemetry; _exchangeQueueName = _settings.GetQueueOrExchangeName(); _log = logFactory.CreateLog(this, Name); _publishLock = new AutoResetEvent(false); _cancellationTokenSource = new CancellationTokenSource(); _thread = new Thread(ConnectionThread) { Name = "RabbitMqPublisherLoop" }; _thread.Start(); }
public RawMessagePublisher( string name, ILog log, IPublisherBuffer buffer, IRabbitMqPublishStrategy publishStrategy, RabbitMqSubscriptionSettings settings, bool publishSynchronously, bool submitTelemetry) { Name = name; _log = log; _buffer = buffer; _settings = settings; _publishSynchronously = publishSynchronously; _publishStrategy = publishStrategy; _submitTelemetry = submitTelemetry; _exchangeQueueName = _settings.GetQueueOrExchangeName(); _publishLock = new AutoResetEvent(false); _cancellationTokenSource = new CancellationTokenSource(); _thread = new Thread(ConnectionThread) { Name = "RabbitMqPublisherLoop" }; _thread.Start(); }
internal void SetBuffer(IPublisherBuffer buffer) { _bufferOverriding = buffer; }