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
752 stars 126 forks source link

Declare queue without consuming messages #142

Closed danikk741 closed 4 months ago

danikk741 commented 8 months ago

Hello. Thank you for your work. I tried to declare a queue with "x-dead-letter-exchange" argument to my main exchange. The problem is that I need to pass Handler for consumer but I do not want messages to be consumed. Messages must be handled automatically by TTL and "x-dead-letter-exchange" option.

Basically, I just need to declare exchanges, queue and bindings without handling messages from queue. What do you think about making Handler argument optional or making Declare functions public?

wagslane commented 4 months ago

You might want to just use the base AMQP library for this. Alternatively you can just pass a NO-OP handler

ntauth commented 3 months ago

You might want to just use the base AMQP library for this. Alternatively you can just pass a NO-OP handler

I'm not sure that's really a solution tbf. What if I want to just publish stuff to a lazy DLX queue indefinitely without necessarily consuming anything? This is currently not possible with a "no-op" consumer, or at least, it is not without closing the consumer right after declaring the queue