twingly / twingly-amqp

:bus: Ruby gem for RabbitMQ subscribing and publishing
0 stars 0 forks source link

Support more arguments when creating a queue #78

Open roback opened 4 years ago

roback commented 4 years ago

To be able to use the Single Active Consumer feature (to be used in https://github.com/twingly/nile/issues/94) we need to be able to set the x-single-active-consumer argument when declaring a queue.

How we setup the queue arguments now: https://github.com/twingly/twingly-amqp/blob/59a2359252b1d34431b95525a25749840a8b2c70/lib/twingly/amqp/subscription.rb#L99-L110

Either we just add that argument like we did for x-max-length, or make sure the user can add any arguments they like.

Chrizpy commented 1 year ago

This is relevant again as I'm experimenting with Quorum queues.

I need to be able to set the headers:

I noticed these errors otherwise when trying to setup a subscriber:

When x-queue-type was not set:

test_quorum_queue-rabbitmq1-1  | 2023-01-03 15:17:18.816992+00:00 [error] <0.28193.0> Channel error on connection <0.28184.0> (172.23.0.1:59186 -> 172.23.0.2:5672, vhost: '/', user: 'guest'), channel 1:
test_quorum_queue-rabbitmq1-1  | 2023-01-03 15:17:18.816992+00:00 [error] <0.28193.0> operation queue.declare caused a channel exception precondition_failed: inequivalent arg 'x-queue-type' for queue 'test' in vhost '/': received none but current is the value 'quorum' of type 'longstr'

When x-quorum-initial-group-size was not set:

test_quorum_queue-rabbitmq1-1  | 2023-01-03 15:18:38.005616+00:00 [error] <0.28488.0> Channel error on connection <0.28479.0> (172.23.0.1:59630 -> 172.23.0.2:5672, vhost: '/', user: 'guest'), channel 1:
test_quorum_queue-rabbitmq1-1  | 2023-01-03 15:18:38.005616+00:00 [error] <0.28488.0> operation queue.declare caused a channel exception precondition_failed: inequivalent arg 'x-quorum-initial-group-size' for queue 'test' in vhost '/': received none but current is the value '2' of type 'long'

Either we just add that argument like we did for x-max-length, or make sure the user can add any arguments they like.

I'm still thinking about what kind of changes I would want to see. I'm leaning toward a more open approach, but I'm not really sure, I think I would need somebody to spitball with here.