本文整理汇总了C#中IQueueManager.LogEvent方法的典型用法代码示例。如果您正苦于以下问题:C# IQueueManager.LogEvent方法的具体用法?C# IQueueManager.LogEvent怎么用?C# IQueueManager.LogEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQueueManager
的用法示例。
在下文中一共展示了IQueueManager.LogEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Executes the specified queue manager.
/// </summary>
/// <param name="queueManager">The queue manager.</param>
/// <returns></returns>
public CommandResult Execute(IQueueManager queueManager)
{
try
{
if (this._retrySkipCount == 0)
{
this._attemptCount++;
this.InternalExecute();
if (this._attemptCount > 1)
{
queueManager.LogEvent(EventLogEntryType.Information, 0x40004405L,Environment.MachineName);
}
return CommandResult.Success;
}
this._retrySkipCount--;
return CommandResult.Retry;
}
catch (Exception exception)
{
var sqlException = exception as SqlException;
var asyncServiceException = exception as AsyncServiceException;
if ((sqlException == null) && (asyncServiceException == null))
{
throw;
}
if (queueManager.ShuttingDown)
{
queueManager.LogEvent(EventLogEntryType.Error, 0xc0004409L, Environment.MachineName, exception.ToString() );
return CommandResult.Failure;
}
return CalculateRetryOrFailure(queueManager, exception);
}
}
示例2: CalculateRetryOrFailure
/// <summary>
/// Calculates the retry original failure.
/// </summary>
/// <param name="queueManager">The queue manager.</param>
/// <param name="e">The decimal.</param>
/// <returns></returns>
private CommandResult CalculateRetryOrFailure(IQueueManager queueManager, Exception e)
{
if (this._attemptCount > queueManager.StateStatusUpdateMaxRetryCount)
{
if (this.RetryWithBackOff && DateTime.Now <= this._retryStartTime.AddDays(3.0))
return CommandResult.Retry;
queueManager.LogEvent(EventLogEntryType.Error, 3221242886L, new object[]
{
Environment.MachineName,
e.ToString()
});
return CommandResult.Failure;
}
if (_attemptCount == 1)
{
queueManager.LogEvent(EventLogEntryType.Error, 2147501060L, new object[]
{
Environment.MachineName,
queueManager.StateStatusUpdateMaxRetryCount,
e.ToString()
});
this._retryStartTime = DateTime.Now;
}
return CommandResult.Retry;
}