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