wagslane / go-rabbitmq

A wrapper of streadway/amqp that provides reconnection logic and sane defaults
https://blog.boot.dev/golang/connecting-to-rabbitmq-in-golang-easy/
MIT License
768 stars 125 forks source link

Question: What happened with rabbitmq.WithConsumeOptionsQuorum #97

Closed TheoAbiel closed 1 year ago

TheoAbiel commented 1 year ago

Hello! I am using a quorum and I don't know how to use it anymore with the new version 0.11.0. Can you please guide me on how to do it?

aaqaishtyaq commented 1 year ago

Hey @TheoAbiel, To set a queue as a quorum queue, you can add queue args while starting a consumer.

args := rabbitmq.Table{
"x-queue-type": "quorum",
}

consumer, err := rabbitmq.NewConsumer(
    conn,
    func(d rabbitmq.Delivery) rabbitmq.Action {
        return rabbitmq.Ack
    },
    "my_queue",
         // ......
        rabbitmq.WithConsumerOptionsQueueArgs(args) // <--------------------- Args to set quorum queue
)
aaqaishtyaq commented 1 year ago

@wagslane, I was thinking of adding a new consumer option to set a queue as a quorum queue. Here is the implementation, Do let me know your thoughts.

TheoAbiel commented 1 year ago

Thank you very much! It works like a charm :grin: !