本文整理汇总了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());
}