achilleasa / dart_amqp

Dart AMQP client implementing protocol version 0.9.1
MIT License
79 stars 40 forks source link

Added queue properties to bindQueueConsumer and bindPrivateQueueConsumer #78

Closed hoylen closed 2 years ago

hoylen commented 2 years ago

Problem

Version 0.2.1 cannot bind to persistent/durable queues.

The implementation of bindQueueConsumer (in the _ExchangeImpl class) invokes channel.queue only with the queueName, so the durable parameter always defaults to false.

https://github.com/achilleasa/dart_amqp/blob/0231485e4584487eb7faefe2ecb1a6f3396338d4/lib/src/client/impl/exchange_impl.dart#L88

If the queue did not exist, it was created as non-durable.

If it did exist, an exception would be thrown because the existing queue has durable=true and this line is trying to get a queue with durable=false.

Solution

This pull request adds durable (and all the other parameters the queue method can have) to the parameters of the bindQueueConsumer method. That way, the invoker can indicate they want to bind to a durable queue. For example,

exchange.bindQueueConsumer('my_queue_name', noAck: false, durable: true);

For consistency, it does the same thing to bindPrivateQueueConsumer.

The change is backward compatible, since the added parameters are all named parameters that are either nullable or have default values.

achilleasa commented 2 years ago

Thanks for your contribution.

Please rebase your changes on top of HEAD so we can get a clean CI run and get this merged.

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 93.115% when pulling 34a13abe136e8a6a612892c14ede37e3a2641bf1 on hoylen:bind-queue-properties into f1844ca21afdd0f95a7af8ea37fb1995ca78986c on achilleasa:master.

hoylen commented 2 years ago

Thanks. I think I've done it correctly, but am not sure if I have used the correct sequence of git commands.