NServiceBus和Azure Service Bus消息丢失

时间:2015-05-22 09:14:58

标签: c# azure iis nservicebus azureservicebus

使用NServiceBus和Azure Service Bus时,我一直在经历一种奇怪但又重新出现的行为。

发布API时,我注意到有时(遗憾的是这不是每次都会发生的稳定行为)请求处理似乎已完成,但消息未到达目标队列。

这很难重现,因为每次部署都不会发生这种情况,但这至少是请求的基本处理: 使用该模型,我创建一个命令,并使用它通过注入的IBus发送它。除了身份验证之外,没有数据库交互。总线本身使用以下配置创建:

var configuration = new BusConfiguration();
configuration.EndpointName("Api");
configuration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
configuration.UseTransport<AzureServiceBusTransport>();
configuration.AzureConfigurationSource();
configuration.UsePersistence<InMemoryPersistence>();


var conventionsBuilder = configuration.Conventions();
conventionsBuilder.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("Abc.") && t.Namespace.EndsWith("Commands"));
conventionsBuilder.DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("Abc.") && t.Namespace.EndsWith("Events"));
conventionsBuilder.DefiningMessagesAs(t => t.Namespace != null && t.Namespace.StartsWith("Abc.") && t.Namespace.EndsWith("RequestResponse"));

ISendOnlyBus bus = Bus.CreateSendOnly(configuration);

我已经尝试了以下方法在本地重现它:

  • 每20毫秒点击本地开发端点时启动本地模拟器。
  • 使用本地IIS。
  • 使用本地IIS,超时一分钟,每隔90秒点击一次,持续5秒。
  • 将本地IIS与循环使用+停止并启动

在本地我无法复制,每条信息总是到达。 在Azure上,它运行在小型云服务上。

任何想法或指示都会非常感激。

0 个答案:

没有答案
相关问题