Creating Quorum queue with ha-mode=all

huangapple go评论59阅读模式
英文:

Creating Quorum queue with ha-mode=all

问题

抱歉,我需要翻译的部分如下:

"I want to apologize in advanced, but I am not very experienced with MassTransit.
I need help creating quorum queue and set "ha-mode" of the queue to "all" for MassTransit 8.0.15

My code is:

services.AddMassTransit(mt =>
{
    mt.AddConsumer(typeof(FileConsumer))
          .Endpoint(e => { e.Name = "my-queue"; e.InstanceId = ""; });

    mt.UsingRabbitMq((context, rmq) =>
    {
    rmq.Host(rabbitMqHost, host =>
   {                        
	host.Username(userName);
	host.Password(password);                        
   });

   rmq.ConfigureEndpoints(context);
   });
});

Any help will be appreciated. Thanks

I tried with adding:
rmq.SetQueueArgument("x-queue-type", "quorum");
rmq.SetQueueArgument("x-ha-mode", "all");

but it didn't worked"

英文:

I want to apologize in advanced, but I am not very experienced with MassTransit.
I need help creating quorum queue and set "ha-mode" of the queue to "all" for MassTransit 8.0.15

My code is:

services.AddMassTransit(mt =>
{
    mt.AddConsumer(typeof(FileConsumer))
          .Endpoint(e => { e.Name = "my-queue"; e.InstanceId = ""; });

    mt.UsingRabbitMq((context, rmq) =>
    {
    rmq.Host(rabbitMqHost, host =>
   {                        
	host.Username(userName);
	host.Password(password);                        
   });

   rmq.ConfigureEndpoints(context);
   });
});

Any help will be appreciated. Thanks

I tried with adding:
rmq.SetQueueArgument("x-queue-type", "quorum");
rmq.SetQueueArgument("x-ha-mode", "all");

but it didn't worked

答案1

得分: 0

我相信 ha-mode 仅适用于经典队列。Quorum 队列完全不同。您可以通过添加配置端点回调来配置接收端点以使用 Quorum 队列:

mt.AddConfigureEndpointsCallback((name, cfg) =>
{
    if(cfg is IRabbitMqEndpointConfigurator rmq)
        rmq.SetQuorumQueue();
});
英文:

I believe ha-mode is only for classic queues. Quorum queues are completely different. You can configure receive endpoints to use quorum queues by adding a configure endpoints callback:

mt.AddConfigureEndpointsCallback((name, cfg) =>
{
    if(cfg is IRabbitMqEndpointConfigurator rmq)
        rmq.SetQuorumQueue();
});

huangapple
  • 本文由 发表于 2023年6月12日 19:08:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76456063.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定