【发布时间】:2021-10-19 15:39:50
【问题描述】:
我已经在 SingleActiveConsumer 模式下注册了接收端点。但是我找不到使用 sendEndpoint 将消息直接发送到队列的方法。我收到以下错误:
The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-single-active-consumer' for queue 'test' in vhost '/': received none but current is the value 'true' of type 'bool'',
我尝试使用总线配置器设置标题“x-single-active-consumer”=true:
var bus = Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.Host("localhost", "/", h =>
{
h.Username("guest");
h.Password("guest");
});
cfg.ConfigureSend(a => a.UseSendExecute(c => c.Headers.Set("x-single-active-consumer", true)));
});
直接在 sendEndpoint 上:
await sendEndpoint.Send(msg, context => {
context.Headers.Set("x-single-active-consumer", true);
});
【问题讨论】:
标签: rabbitmq masstransit