我只是在收听服务总线消息时遇到重复错误。没有任何消息流量通过。我每30秒检查一次取消。这在一项任务中发生,并且有几个同时运行的侦听任务:
System.Exception: AutoEventManager messaging error 2 since 03:10:45 AM with clientId 0d0815ab-ed35-4bd4-9df9-fdbf6d613053. See inner exception.
---> System.AggregateException: One or more errors occurred.
---> Microsoft.ServiceBus.Messaging.MessagingException: The server was unable to process the request; please retry the operation. If the problem persists, please contact your Service Bus administrator and provide the tracking id. TrackingId:9633ee13-27b4-4ffd-8a2c-8096cad90df0_G18, Timestamp:5/5/2015 11:05:02 AM
---> System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: The server was unable to process the request; please retry the operation. If the problem persists, please contact your Service Bus administrator and provide the tracking id. TrackingId:9633ee13-27b4-4ffd-8a2c-8096cad90df0_G18, Timestamp:5/5/2015 11:05:02 AM Server stack trace:
at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.ThrowIfFaultMessage(Message wcfMessage)
at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.HandleMessageReceived(IAsyncResult result) Exception rethrown at [0]: at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.DuplexCorrelationAsyncResult.End(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.b__4(RequestAsyncResult thisPtr, IAsyncResult r)
at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) Exception rethrown at [1]:
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result)
at
以下是实际处理消息的代码,所有代码都运行得很好。
public void AddAsyncListener(string clientId)
{
var cToken = _cSource.Token;
_mgrTasks.Add(new KeyValuePair<string, Task>(clientId, Task.Run(() =>
{
try
{
var errCount = 0;
var errTimer = DateTime.Now;
var cfgSvc = _ioc.GetInstance<IClientConfigService>();
var conString = cfgSvc.GetNeoBusConString(clientId);
var cmdFilter = new SqlFilter(String.Format("MessageType <> {0}",
(int)MessageTypeEnum.Progress));
var namespaceMgr = NamespaceManager.CreateFromConnectionString(conString);
if (!namespaceMgr.SubscriptionExists(clientId, "LogManager"))
namespaceMgr.CreateSubscription(clientId, "LogManager", cmdFilter);
var cmdClient = SubscriptionClient.CreateFromConnectionString(conString, clientId, "LogManager");
var logEventService = _ioc.GetInstance<ILogEventService>();
logEventService.SetScope(clientId);
while (!cToken.IsCancellationRequested)
{
try
{
var message = cmdClient.ReceiveAsync(TimeSpan.FromSeconds(30)).Result;
if (message == null) continue;
{rest of message processing here}
哦,处理这些任务的应用程序也在Azure中作为Cloud Service运行。
它似乎似乎有任何可怕的效果,我正在捕获它们并只是重试通常成功的ReceiveAsync。我不习惯忽视间歇性错误......
任何见解都将受到赞赏。
答案 0 :(得分:1)
根据此MSDN响应,这是好的 ...
大多数失败都是短暂的,请确保您没有关闭客户端重试。在瞬态故障的情况下,客户端重试将自动重试。您可以在https://msdn.microsoft.com/en-us/library/microsoft.servicebus.retrypolicy.aspx
找到有关重试政策的更多信息大量的CommunicationExceptions可能是由于网络不良或客户端资源耗尽,如高CPU,线程数或内存。你可以先看看那些。