Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more arguments when creating a queue #78

Open
roback opened this issue Nov 6, 2019 · 1 comment
Open

Support more arguments when creating a queue #78

roback opened this issue Nov 6, 2019 · 1 comment

Comments

@roback
Copy link
Member

roback commented Nov 6, 2019

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:

def queue_options
{
durable: true,
arguments: queue_arguments,
}
end
def queue_arguments
{}.tap do |arguments|
arguments["x-max-length"] = @max_length if @max_length
end
end

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
Copy link
Contributor

Chrizpy commented Jan 3, 2023

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

I need to be able to set the headers:

  • x-quorum-initial-group-size
  • x-queue-type

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.

roback added a commit that referenced this issue Oct 5, 2023
Now we support both classic queues (which is what we used before), and quorum
queues.

Only "mirrored classic queues" are deprecated, not classic queues in general,
so I opted to continue supporting classic queues, even though we'll most likely
not use them once we have switched all of our production queues to quorum queues.

I added an extra argument to the classes that creates queues takes, which tells them
what kind of queue to create. Based on that argument, the classes then either uses the
`Channel#queue` or `Channel#quorum_queue` method to setup the queue.
Those helpåer methods were added to Bunny in ruby-amqp/bunny@0cae5f8

Related to twingly/ansible#2316

Also a bit related to #78 (as we now support the `x-queue-type` argument). I'm not sure
we need to support the `x-quorum-initial-group-size` argument mentioned there though,
as we will only have three servers, which is the default value for that argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants