private void AssertQueue(ExchangeQueue queue) { if (queue.RouteKeys != null) { if (queue.RouteKeys.Any(k => k == null)) { throw new InvalidOperationException( $"The queue: {queue.QueueName} defined on exchange: {ExchangeName} has null route key values."); } } }
public static EventingBasicConsumer GetBasicConsumer(this IModel channel, ExchangeQueue queue) { Check.NotNull(channel, nameof(channel)); Check.NotNull(queue, nameof(queue)); var consumer = new EventingBasicConsumer(channel); channel.BasicConsume(queue.QueueName, queue.Settings, consumer); return(consumer); }
/// <summary> /// Allows a derived exchange to configure queues that should be declared /// when the exchange is created. /// </summary> /// <param name="name">The name of the queue.</param> /// <param name="config">Configuration delegate that is specified /// to configure the queue.</param> protected void QueueDeclare(string name, Action <ExchangeQueue> config = null) { Check.NotNullOrWhiteSpace(name, nameof(name)); var exchangeQueue = new ExchangeQueue { QueueName = name, Settings = (QueueSettings)_queueSettings.Clone() }; config?.Invoke(exchangeQueue); _queues.Add(exchangeQueue); }