我正在将Masstransit与Azure Service Bus一起使用dotnet核心来处理传奇。该应用程序的核心功能按预期工作,但是当尝试访问它创建的内部队列时,Masstransit的日志显示404错误。
记录的异常是:
Exception received on receiver: sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg?autodelete=300 during AcceptMessageSession
Microsoft.Azure.ServiceBus.MessagingEntityNotFoundException: Put token failed. status-code: 404, status-description:
The messaging entity 'sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg' could not be found.
TrackingId:1e0d96d2-b15f-413a-8453-cd924ad2595b_G31, SystemTracker:MYSB.servicebus.windows.net:MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg, Timestamp:2019-02-25T20:47:57.
ReceiveTransport Faulted: sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg?autodelete=300
System.AggregateException: One or more errors occurred. (One or more errors occurred. (Put token failed. status-code: 404, status-description: The messaging entity 'sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg' could not be found. TrackingId:1e0d96d2-b15f-413a-8453-cd924ad2595b_G31, SystemTracker:MYSB.servicebus.windows.net:MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg, Timestamp:2019-02-25T20:47:57.)) ---> System.AggregateException: One or more errors occurred. (Put token failed. status-code: 404, status-description: The messaging entity 'sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg' could not be found. TrackingId:1e0d96d2-b15f-413a-8453-cd924ad2595b_G31, SystemTracker:MYSB.servicebus.windows.net:MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg, Timestamp:2019-02-25T20:47:57.) ---> Microsoft.Azure.ServiceBus.MessagingEntityNotFoundException: Put token failed. status-code: 404, status-description: The messaging entity 'sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg' could not be found. TrackingId:1e0d96d2-b15f-413a-8453-cd924ad2595b_G31, SystemTracker:MYSB.servicebus.windows.net:MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg, Timestamp:2019-02-25T20:47:57.
at Microsoft.Azure.ServiceBus.SessionClient.AcceptMessageSessionAsync(String sessionId, TimeSpan operationTimeout) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\SessionClient.cs:line 334
at Microsoft.Azure.ServiceBus.SessionReceivePump.SessionPumpTaskAsync() in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\SessionReceivePump.cs:line 125
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at MassTransit.Azure.ServiceBus.Core.Pipeline.MessageReceiverFilter.GreenPipes.IFilter<MassTransit.Azure.ServiceBus.Core.ClientContext>.Send(ClientContext context, IPipe`1 next)
at MassTransit.Azure.ServiceBus.Core.Pipeline.MessageReceiverFilter.GreenPipes.IFilter<MassTransit.Azure.ServiceBus.Core.ClientContext>.Send(ClientContext context, IPipe`1 next)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at MassTransit.Azure.ServiceBus.Core.Transport.ReceiveTransport.<>c__DisplayClass13_0.<<Receiver>b__0>d.MoveNext()
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. (Put token failed. status-code: 404, status-description: The messaging entity 'sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg' could not be found. TrackingId:1e0d96d2-b15f-413a-8453-cd924ad2595b_G31, SystemTracker:MYSB.servicebus.windows.net:MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg, Timestamp:2019-02-25T20:47:57.) ---> Microsoft.Azure.ServiceBus.MessagingEntityNotFoundException: Put token failed. status-code: 404, status-description: The messaging entity 'sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg' could not be found. TrackingId:1e0d96d2-b15f-413a-8453-cd924ad2595b_G31, SystemTracker:MYSB.servicebus.windows.net:MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg, Timestamp:2019-02-25T20:47:57.
at Microsoft.Azure.ServiceBus.SessionClient.AcceptMessageSessionAsync(String sessionId, TimeSpan operationTimeout) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\SessionClient.cs:line 334
at Microsoft.Azure.ServiceBus.SessionReceivePump.SessionPumpTaskAsync() in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\SessionReceivePump.cs:line 125
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.Azure.ServiceBus.MessagingEntityNotFoundException: Put token failed. status-code: 404, status-description: The messaging entity 'sb://MYSB.servicebus.windows.net/MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg' could not be found. TrackingId:1e0d96d2-b15f-413a-8453-cd924ad2595b_G31, SystemTracker:MYSB.servicebus.windows.net:MYCOMPNAME_dotnet_bus-_dkdyyybrsrcgyw19bdmjsapuyg, Timestamp:2019-02-25T20:47:57.
at Microsoft.Azure.ServiceBus.SessionClient.AcceptMessageSessionAsync(String sessionId, TimeSpan operationTimeout) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\SessionClient.cs:line 334
at Microsoft.Azure.ServiceBus.SessionReceivePump.SessionPumpTaskAsync() in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\SessionReceivePump.cs:line 125<---
<---
在应用程序启动后大约5分钟开始出现错误,这似乎是该队列设置为自动删除时。请注意,导致错误的队列不是我正在为应用程序中的传奇使用的队列,它似乎是由Masstransit中的内部进程创建的队列。
对于引起此问题的任何帮助或有关此队列用途的信息,将不胜感激。
(编辑) 配置:
var bus = Bus.Factory.CreateUsingAzureServiceBus(cfg =>
{
// SetEntityNameFormatters
var host = cfg.Host(
new Uri(settings.HostAddress),
h =>
{
h.TransportType = TransportType.AmqpWebSockets;
h.RetryLimit = settings.RetryLimit;
h.OperationTimeout = TimeSpan.FromSeconds(settings.TimeOutSeconds);
h.TokenProvider =
TokenProvider.CreateSharedAccessSignatureTokenProvider(settings.KeyName,
settings.SharedAccessKey);
});
cfg.ConfigureDefaultSettings(queueSettings.Default);
cfg.ReceiveEndpoint(host, $"{environment}.{queueSettings.Queue.Name}", e =>
{
e.ConfigureReceiverSettings(queueSettings.Queue);
e.Saga<SagaConsumer>(serviceProvider);
e.Consumer<SagaFaultConsumer>(serviceProvider);
e.RemoveSubscriptions = true;
});
cfg.UseSerilog(Log.Logger);
cfg.UseServiceBusMessageScheduler();
});
bus.Start();
ConfigureDefaultSettings和ConfigureReceiverSettings方法根据appsettings设置总线。我当前拥有的设置是:
"AzureConnectionSettings": {
"RetryLimit": 5,
"TimeOutSeconds": 5
},
"QueueSettings": {
"Default": {
"RequireSession": true,
"DuplicateDetection": {
"Enabled": true,
"HistoryTimeWindowMinutes": 5
},
"RetryPolicy": {
"Type": "Exponential",
"RetryLimit": 5,
"MinIntervalSeconds": 1,
"MaxIntervalSeconds": 10,
"DeltaSeconds": 5
}
},
"Queue": {
"Name": "QueueName",
"RequireSession": true
}
}