MassTransit 在配置非持久消息时发送持久消息
MassTransit sends a durable message when a non durable one is configured
我正在尝试向队列发送消息。队列已经存在并且配置为非持久队列。这是我的代码:
ServiceBus = Bus.Factory.CreateUsingRabbitMq(sbc =>
{
sbc.PurgeOnStartup = true;
sbc.Durable = false;
sbc.Exclusive = false;
sbc.Host(new Uri($"rabbitmq://{RabbitMqHost}"), cfg =>
{
cfg.ConfigureRabbitMq();
});
});
ServiceBus.Request(
new Uri(serviceUri),
new EngineStartingMessage() { Version = ApplicationConfig.SystemVersion },
rCfg =>
{
rCfg.Durable = false;
rCfg.Timeout = new TimeSpan(0, 0, 30);
rCfg.Handle<EngineStartingResponse>(async hContext =>
{
//Response handling
});
});
如您所见,Durable 设置为 false。在 ServiceBus.Request 我得到以下异常:
The AMQP operation was interrupted: AMQP close-reason, initiated by
Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'durable'
for exchange 'QUEUENAMEHERE' in vhost '/': received 'true' but current
is 'false'", classId=40, methodId=10, cause=
知道为什么邮件仍然作为持久发送的吗?
Durable 标志仅指定不应将特定请求消息持久保存到磁盘。
如果您想解决此问题,请将 ?durable=false
添加到 serviceUri,以匹配在处理请求的接收端点指定的内容。
我正在尝试向队列发送消息。队列已经存在并且配置为非持久队列。这是我的代码:
ServiceBus = Bus.Factory.CreateUsingRabbitMq(sbc =>
{
sbc.PurgeOnStartup = true;
sbc.Durable = false;
sbc.Exclusive = false;
sbc.Host(new Uri($"rabbitmq://{RabbitMqHost}"), cfg =>
{
cfg.ConfigureRabbitMq();
});
});
ServiceBus.Request(
new Uri(serviceUri),
new EngineStartingMessage() { Version = ApplicationConfig.SystemVersion },
rCfg =>
{
rCfg.Durable = false;
rCfg.Timeout = new TimeSpan(0, 0, 30);
rCfg.Handle<EngineStartingResponse>(async hContext =>
{
//Response handling
});
});
如您所见,Durable 设置为 false。在 ServiceBus.Request 我得到以下异常:
The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'durable' for exchange 'QUEUENAMEHERE' in vhost '/': received 'true' but current is 'false'", classId=40, methodId=10, cause=
知道为什么邮件仍然作为持久发送的吗?
Durable 标志仅指定不应将特定请求消息持久保存到磁盘。
如果您想解决此问题,请将 ?durable=false
添加到 serviceUri,以匹配在处理请求的接收端点指定的内容。