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

[DEVEX-2399]: Make errored queues configurable #213

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

emilianobovetti
Copy link

@emilianobovetti emilianobovetti commented Dec 24, 2024

Currently Helper.declare/2 creates a dead letter queue when the arguments contains a tuple like {"x-dead-letter-exchange", :longstr, dle}.
Since rabbit 4.0 will remove queue mirroring for classic queues, many queues need to be migrated to quorum. However declare/2 will always use the default type for dead letters, so we need a mechanism to change their types.
Ideally I'd like to refactor the Helper module, as its functions have a complex interface that has proven difficult to maintain and does not consistently behave as expected.
Unfortunately, many applications depend on declare/2 to setup both the queue and its dead letter. When {"x-queue-type", :longstr, "quorum"} is passed in the arguments amqpx will create a quorum queue and a classic dead letter, which is likely not the desired behavior.
The current plan is to use the same x-queue-type for both the queue and its dead letter. This change will be introduced in amqpx 7.0 as a breaking update, aiming to minimize the number of applications with mismatched queue types for dead letters.

ref: https://prima-assicurazioni-spa.myjetbrains.com/youtrack/issue/DEVEX-2399

@emilianobovetti emilianobovetti force-pushed the DEVEX-2399/task/feat/make-errored-queues-configurable branch from 35fea46 to f9ee7dc Compare December 24, 2024 12:06
@emilianobovetti emilianobovetti marked this pull request as ready for review December 27, 2024 10:23
@emilianobovetti emilianobovetti requested a review from a team as a code owner December 27, 2024 10:23
Copy link
Member

@MaeIsBad MaeIsBad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a x-dead-letter-queue-type option, to allow overwriting the default behavior?

:queue => Basic.queue(),
:exchange => Basic.exchange(),
:routing_key => String.t(),
optional(:original_routing_keys) => [String.t() | [String.t()]],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is this a nested array?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here declare creates a nested string list

original_routing_keys = Enum.map(exchanges, & &1.routing_keys)

we should probably use a flat_map and remove the flatten

@emilianobovetti
Copy link
Author

Should there be a x-dead-letter-queue-type option, to allow overwriting the default behavior?

I've briefly looked at other rabbit/amqp clients, it seems none of them automatically create dead letter queues as declare does
I think that letting applications to manage the declaration of their own resources is far simpler and already supported (like manually calling Helper.setup_dead_lettering and Helper.setup_queue has less magic involved)

@emilianobovetti emilianobovetti requested review from net02 and mbusi January 7, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants