本文整理匯總了C#中RabbitMQ.Client.Events.BasicDeliverEventArgs.GetAttemptCount方法的典型用法代碼示例。如果您正苦於以下問題:C# BasicDeliverEventArgs.GetAttemptCount方法的具體用法?C# BasicDeliverEventArgs.GetAttemptCount怎麽用?C# BasicDeliverEventArgs.GetAttemptCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RabbitMQ.Client.Events.BasicDeliverEventArgs
的用法示例。
在下文中一共展示了BasicDeliverEventArgs.GetAttemptCount方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AppendException
protected virtual int AppendException(BasicDeliverEventArgs message, Exception exception)
{
if (exception == null)
return 0;
var currentAttempt = message.GetAttemptCount();
message.SetAttemptCount(currentAttempt + 1); // 1-based value
this.adapter.AppendException(message, exception, currentAttempt);
return currentAttempt;
}
示例2: RetryMessage
protected virtual void RetryMessage(BasicDeliverEventArgs message, Exception exception)
{
var nextAttempt = message.GetAttemptCount() + 1;
message.SetAttemptCount(nextAttempt);
// 0-based to 1-based value
Log.Debug("Message '{0}' has been attempted {1} times.", message.MessageId(), nextAttempt);
if (nextAttempt > this.configuration.MaxAttempts)
this.ForwardToPoisonMessageExchange(message, exception);
else
this.ForwardTo(message, this.configuration.InputQueue.ToPublicationAddress());
}