【发布时间】:2021-06-09 01:08:15
【问题描述】:
我通过一系列活动实现了路由单。其中之一在 Azure 中执行长时间运行的过程,甚至需要 15-20 分钟。我注意到 10 分钟后,虽然进程仍在运行,但活动再次执行。它打破了整个路由滑动,因为第一个进程仍在进行中,重试会产生错误。
我使用 Azure 服务总线作为消息代理。我在文档中找不到对此主题的任何引用,所以我想知道这是否特定于 Courier 并且可以更改以使其根本不重新交付,或者这是某种不正确的行为?
编辑:
修改后的代码如下:
services.AddMassTransit(c =>
{
c.SetEndpointNameFormatter(new DefaultEndpointNameFormatter(false));
c.AddConsumersFromNamespaceContaining<TestConsumer>();
c.AddActivitiesFromNamespaceContaining<ActivityBase<IArguments, LogBase>>();
c.UsingAzureServiceBus((ctx, cfg) =>
{
cfg.Host(hostContext.Configuration.GetConnectionString("connection_string"));
cfg.LockDuration = TimeSpan.FromMinutes(25);
cfg.MaxAutoRenewDuration = TimeSpan.FromMinutes(25);
cfg.MaxDeliveryCount = 1;
cfg.ConfigureEndpoints(ctx);
});
});
【问题讨论】:
标签: c# .net-core masstransit