Skip to content

add the ability to create internal queues as quorum type instead of hard-coded classic - #80

Open
Michalis-Apostolou wants to merge 3 commits into
masterfrom
option_create_delayed_queues_and_reply_as_quorum
Open

Michalis-Apostolou wants to merge 3 commits into
masterfrom
option_create_delayed_queues_and_reply_as_quorum

Conversation

@Michalis-Apostolou

@Michalis-Apostolou Michalis-Apostolou commented Sep 14, 2026 •

Copy link
Copy Markdown

Need

We need to upgrade the rmq cluster to version 4+. in this version High Availability (HA) policy with mirror queues has been deprecated and completely removed https://www.rabbitmq.com/docs/3.13/ha . So we need to replace all classic queue definitions with quorum

Problem

Rabbit-queue creates internal queues to implement scheduled publishing for a message

  1. there is a queue created on app connect {prefix}_delay_reply
  2. The publisher for a delayed messaged for XXX amount creates the queue {prefix}_delay_{XXX}

Example:
image

Since the library does not define the type of the queue , the are created to what is default on the virtual host.

If can't/don't want to change the default queue type of the virtual host , you should have the ability to define if these queues should be created as quorum or not.

Solution

By utilizing a new option available in the package scheduledPublishQueuesAsQuorum on rabbit config, this will passed around during the creating of the queues.
In order to avoid conflicts between already created classic queues and newly created quorum queues , the naming convention changes to

  1. {prefix}_delay_quorum_reply
  2. {prefix}_delay_quorum_{XXX}
image

Comment thread test/delay-queue.test.ts Outdated
'delay',
{
deadLetterExchange: '',
deadLetterRoutingKey: 'delay_reply',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should this be delay_quorum_reply?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This value is derived by module's variable delayedQueueNameReply

deadLetterRoutingKey: delayedQueueNameReply,
which is set by createDelayQueueReply parameter.
Amended the test , to also call createDelayQueueReply with createQueueAsQuorum , so it set the expected queue name.

@iliasbibas iliasbibas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think we need to look a bit deeper on how quorum queues handle dead lettering, a policy might be needed if we need the messages to end up in a DLQ instead of silently dropped.

Comment thread ts/rabbit.ts
}
if (!publish && this.scheduledPublish) {
await createDelayQueueReply(this.consumeChannel, this.updateName('delay'));
const createAsQuorum = this.defaultQueueType === 'quorum';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💭 This uses defaultQueueType, but below in publishWithDelay scheduledPublishQueuesAsQuorum is used. This might lead to having the delay and the reply queues with different types, not sure if we want that.

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