rebus-org / Rebus.RabbitMq

:bus: RabbitMQ transport for Rebus
https://mookid.dk/category/rebus
Other
63 stars 44 forks source link

Ensure that quorum queues are supported #63

Closed mookid8000 closed 4 years ago

mookid8000 commented 4 years ago

not entirely sure what it is, though, but using them seems to result in the following exception:

Unhandled Exception: Rebus.Injection.ResolutionException: Could not resolve Rebus.Bus.IBus with decorator depth 0 - registrations: Rebus.Injection.Injectionist+Handler ---> RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'x-queue-type' for queue 'consumer' in vhost 'local_oh': received none but current is the value 'quorum' of type 'longstr'", classId=50, methodId=10, cause=

   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)

   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)

   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)

   at Rebus.RabbitMq.RabbitMqTransport.DeclareQueue(String address, IModel model, Boolean durable)

   at Rebus.RabbitMq.RabbitMqTransport.CreateQueue(String address)

   at Rebus.RabbitMq.RabbitMqTransport.Initialize()

   at Rebus.Config.RebusConfigurer.<>c__DisplayClass12_1.<Start>b__25(IResolutionContext c)

   at Rebus.Injection.Injectionist.Resolver`1.InvokeResolver(IResolutionContext context)

   at Rebus.Injection.Injectionist.ResolutionContext.Get[TService]()

   --- End of inner exception stack trace ---

   at Rebus.Injection.Injectionist.ResolutionContext.Get[TService]()

   at Rebus.Injection.Injectionist.Get[TService]()

   at Rebus.Config.RebusConfigurer.Start()

so maybe the solution is simply to enable customizing the properties passed to RabbitMQ when declaring things (exchange, queue, etc)

mookid8000 commented 4 years ago

It already works: By customizing the input queue, passing an appropriate argument to it, the input queue can be declared of the "quorum" type:

Configure.With(activator)
    .Transport(t =>
    {
        t.UseRabbitMq(connectionString, queueName)
            .InputQueueOptions(q => q.AddArgument("x-queue-type", "quorum"));
    })
    .Start();

which will result in image

CHeck out this test for a working example.