Beispiel #1
0
        public Task BindQueueAsync(QueueConfiguration queue, ExchangeConfiguration exchange, string routingKey)
        {
            if (exchange.IsDefaultExchange())
            {
                return(_completed);
            }
            var bindKey = $"{queue.FullQueueName}_{exchange.ExchangeName}_{routingKey}";

            if (_queueBinds.Contains(bindKey))
            {
                return(_completed);
            }
            var scheduled = new ScheduledBindQueueTask
            {
                Queue      = queue,
                Exchange   = exchange,
                RoutingKey = routingKey
            };

            _topologyTasks.Enqueue(scheduled);
            EnsureWorker();
            return(scheduled.TaskCompletionSource.Task);
        }
Beispiel #2
0
        public Task BindQueueAsync(QueueConfiguration queue, ExchangeConfiguration exchange, string routingKey)
        {
            if (exchange.IsDefaultExchange())
            {
                /*
                 *      "The default exchange is implicitly bound to every queue,
                 *      with a routing key equal to the queue name. It it not possible
                 *      to explicitly bind to, or unbind from the default exchange."
                 */
                return(_completed);
            }
            if (queue.IsDirectReplyTo())
            {
                /*
                 *      "Consume from the pseudo-queue amq.rabbitmq.reply-to in no-ack mode. There is no need to
                 *      declare this "queue" first, although the client can do so if it wants."
                 *      - https://www.rabbitmq.com/direct-reply-to.html
                 */
                return(_completed);
            }
            var bindKey = $"{queue.FullQueueName}_{exchange.ExchangeName}_{routingKey}";

            if (_queueBinds.Contains(bindKey))
            {
                return(_completed);
            }
            var scheduled = new ScheduledBindQueueTask
            {
                Queue      = queue,
                Exchange   = exchange,
                RoutingKey = routingKey
            };

            _topologyTasks.Enqueue(scheduled);
            EnsureWorker();
            return(scheduled.TaskCompletionSource.Task);
        }
Beispiel #3
0
 public bool IsInitialized(ExchangeConfiguration exchange)
 {
     return(exchange.IsDefaultExchange() || exchange.AssumeInitialized || _initExchanges.Contains(exchange.ExchangeName));
 }