英文:
Correlation Id missing dashes with MassTransit and Azure Service Bus
问题
在使用 MassTransit 和 Azure Service Bus 时,消息中的关联 ID Guid 值会被移除破折号。
这是我们设置关联 ID 的方式,根据文档:
services.AddMassTransit(x =>
{
MessageCorrelation.UseCorrelationId<MyMessage>(x => Guid.NewGuid());
x.AddConsumer<...Consumer>();
x.UsingAzureServiceBus((IBusRegistrationContext context, IServiceBusBusFactoryConfigurator cfg) =>
{
cfg.Host(config.AzureServiceBus.ConnectionString);
// 其他配置...
}
}
我们使用 MassTransit 的 NuGet 版本是 v8.0.6,但尝试使用 8.0.12 也没有帮助。
我在 masstransit 的 GitHub 仓库 中没有找到与此相关的已报告问题。
看起来像是一个 bug,因为我无法想出任何原因为什么应该移除破折号。
英文:
Dashes are removed from the correlation id Guid value in messages while using MassTransit and Azure Service Bus.
Here is how we set the correlation id, which is according to the documentation:
services.AddMassTransit(x =>
{
MessageCorrelation.UseCorrelationId<MyMessage>(x => Guid.NewGuid());
x.AddConsumer<...Consumer>();
x.UsingAzureServiceBus((IBusRegistrationContext context, IServiceBusBusFactoryConfigurator cfg) =>
{
cfg.Host(config.AzureServiceBus.ConnectionString);
....
}
}
We are on MassTransit nuget v8.0.6 but trying with 8.0.12 didn't help.
I have not found any reported issues related to this on masstransit github repo.
It seems like a bug as I cannot think of any reason why dashes should be removed.
答案1
得分: 2
I found it here by searching the MassTransit code:
if (context.CorrelationId.HasValue)
message.CorrelationId = context.CorrelationId.Value.ToString("N");
So indeed, it seems like the developers chose that particular format on purpose.
英文:
I found it here by searching the MassTransit code:
if (context.CorrelationId.HasValue)
message.CorrelationId = context.CorrelationId.Value.ToString("N");
So indeed, it seems like the developers chose that particular format on purpose.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论