Enforce classic queue type for non-durable and exclusive queues#70
Enforce classic queue type for non-durable and exclusive queues#70
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enforces that non-durable, exclusive, or auto-delete queues always use the classic queue type, preventing incompatible configurations with quorum queues which must be durable and cannot be exclusive or auto-delete.
Changes:
- Added logic to automatically set queue type to 'classic' for non-durable, exclusive, or auto-delete queues
- Added comprehensive test coverage for the three enforcement scenarios (non-durable, exclusive, auto-delete)
- Updated documentation explaining the queue type behavior and enforcement rules
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ts/queue.ts | Added conditional logic to enforce 'classic' queue type for non-durable, exclusive, or auto-delete queues |
| test/rabbit.test.ts | Added three test cases verifying queue type enforcement for non-durable, exclusive, and auto-delete scenarios |
| test/queue.test.ts | Updated existing test expectation to include the 'x-queue-type': 'classic' in arguments for exclusive queue |
| README.md | Added "Queue Type Behavior" section documenting the enforcement rules and queue type immutability |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| queueOptions.arguments = { ...queueOptions.arguments, 'x-max-priority': priority }; | ||
| } | ||
| if (!durable || exclusive || autoDelete) { | ||
| queueOptions.arguments ??= {}; |
There was a problem hiding this comment.
The nullish coalescing assignment operator at line 58 is redundant. At line 52, queueOptions.arguments is initialized with { ...this.options.arguments }, which will always result in an object (empty object if this.options.arguments is undefined). Therefore, queueOptions.arguments can never be null or undefined at line 58, making the ??= operator unnecessary. You can simply assign directly: queueOptions.arguments['x-queue-type'] = 'classic';
| queueOptions.arguments ??= {}; |
No description provided.