public RabbitAsyncPublisher(IConnectionFactory connectionFactory, bool publisherConfirms = true) { _queue = new BlockingCollection <EnqueuedMessage>(); _confirmStrategy = publisherConfirms ? (IConfirmStrategy) new AckNackConfirmStrategy() : new NoConfirmStrategy(); _connectionHolder = new ConnectionHolder(new[] { connectionFactory }, _confirmStrategy); _thread = new Thread(ThreadLoop) { Name = typeof(RabbitAsyncPublisher).Name }; _thread.Start(); }
internal ConnectionHolder(IConnectionFactory[] connectionFactories, IConfirmStrategy confirmStrategy) { _confirmStrategy = confirmStrategy; _connectionFactories = Shuffle(connectionFactories); }