当前位置: 首页>>代码示例>>C#>>正文


C# QueueName.GetExchangeName方法代码示例

本文整理汇总了C#中QueueName.GetExchangeName方法的典型用法代码示例。如果您正苦于以下问题:C# QueueName.GetExchangeName方法的具体用法?C# QueueName.GetExchangeName怎么用?C# QueueName.GetExchangeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueueName的用法示例。


在下文中一共展示了QueueName.GetExchangeName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RabbitMQQueue

        public RabbitMQQueue(QueueName queueName, IQueueListener listener, IConnection connection,
            Encoding encoding = null, QueueOptions options = default(QueueOptions))
        {
            if (queueName == null) throw new ArgumentNullException("queueName");
            if (listener == null) throw new ArgumentNullException("listener");
            if (connection == null) throw new ArgumentNullException("connection");

            _queueName = queueName;
            _queueExchange = _queueName.GetExchangeName();
            _retryQueueName = queueName.GetRetryQueueName();
            _retryExchange = _queueName.GetRetryExchangeName();
            _deadLetterExchange = _queueName.GetDeadLetterExchangeName();

            _listener = listener;
            _connection = connection;
            _encoding = encoding ?? Encoding.UTF8;
            _ttl = options.TTL;
            _maxAttempts = Math.Max(options.MaxAttempts, 1);
            _retryDelay = options.RetryDelay < TimeSpan.Zero ? TimeSpan.Zero : options.RetryDelay;
            _cancellationTokenSource = new CancellationTokenSource();

            var autoAcknowledge = options.AutoAcknowledge;
            var concurrencyLimit = Math.Max(options.ConcurrencyLimit, 1);
            _consumers = new DurableConsumer[concurrencyLimit];
            for (var i = 0; i < _consumers.Length; i++)
            {
                var consumerTag = _queueName + "_" + i;
                _consumers[i] = new DurableConsumer(_connection, queueName, HandleDelivery, consumerTag,
                    autoAcknowledge);
            }
        }
开发者ID:tdbrian,项目名称:Platibus,代码行数:31,代码来源:RabbitMQQueue.cs

示例2: DeleteQueue

        private static void DeleteQueue(QueueName queueName)
        {
            var connectionFactory = new ConnectionFactory { Uri = RabbitMQUri.ToString() };
            using (var connection = connectionFactory.CreateConnection())
            using (var channel = connection.CreateModel())
            {
                // We have to declare the queue as a persistence queue because this is 
                // called before the queue is created by the RabbitMQQueueingService
                var queueExchange = queueName.GetExchangeName();
                var retryExchange = queueName.GetRetryExchangeName();
                var deadLetterExchange = queueName.GetDeadLetterExchangeName();
                var retryQueueName = queueName.GetRetryQueueName();

                channel.QueueDeleteNoWait(queueName, false, false);
                channel.QueueDeleteNoWait(retryQueueName, false, false);
                channel.ExchangeDeleteNoWait(queueExchange, false);
                channel.ExchangeDeleteNoWait(retryExchange, false);
                channel.ExchangeDeleteNoWait(deadLetterExchange, false);
            }
        }
开发者ID:tdbrian,项目名称:Platibus,代码行数:20,代码来源:RabbitMQMessageQueueingServiceTests.cs


注:本文中的QueueName.GetExchangeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。