【发布时间】:2020-11-12 01:44:18
【问题描述】:
我们的公共交通/Azure 服务总线设置运行良好,但还有一个我们非常想使用但似乎无法正常工作的功能 - 预定的重新交付。
这是启动中的代码:
busFactoryConfig.UseServiceBusMessageScheduler();
busFactoryConfig.SubscriptionEndpoint(Constants.SubscriptionName, Constants.TopicName, configurator =>
{
configurator.UseScheduledRedelivery(r => r.Intervals(TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(30)));
configurator.UseMessageRetry(r =>
{
r.Immediate(2);
r.Ignore<InvalidCastException>(); //we don't want to retry here, the message content is invalid
});
这似乎与documentation 匹配得很好。虽然文档似乎只提到了 RabbitMQ。
但是,当这实际触发时,会引发公共交通异常,并且重新递送不起作用。这是使用 .NET Core 3.1、MassTransit 7.0.1 和 Azure 服务总线主题。
错误(故意抛出以触发重试):
MassTransit.TransportException: **ADDRESS** => The message delivery could not be rescheduled
---> System.AggregateException: One or more errors occurred. (The specified resource description is invalid. TrackingId:cda5544e-90e4-4818-97f9-4de3ee55aaad_G46, SystemTracker:**TOPIC**, Timestamp:2020-07-22T13:22:23) (BAM! <- MY ERROR)
---> Microsoft.Azure.ServiceBus.ServiceBusException: The specified resource description is invalid. TrackingId:cda5544e-90e4-4818-97f9-4de3ee55aaad_G46, SystemTracker:**TOPIC**, Timestamp:2020-07-22T13:22:23
---> System.ArgumentException: The specified resource description is invalid. TrackingId:cda5544e-90e4-4818-97f9-4de3ee55aaad_G46, SystemTracker:**TOPIC**, Timestamp:2020-07-22T13:22:23
我尝试了不同的设置,更类似于文档:
busFactoryConfig.UseMessageScheduler(uri); //Uri is my sb endpoint, minus Endpoint=
这给我们带来了不同的错误:
InvalidAudience: The authorization header contains a token with a wrong audience.
快速阅读会发现这与 Azure 使用密钥的方式有关,并且可能已过时。但是,这与我用来成功连接到总线的 URI 相同 - 我所做的只是删除 Endpoint= 以便在构造 new Uri() 时它是一个有效的 URI。
安排的重新交付是否适用于 Azure 服务总线的 MT?我在配置中遗漏了什么吗?
任何帮助将不胜感激。
【问题讨论】:
标签: asp.net-core azureservicebus masstransit