-
-
Notifications
You must be signed in to change notification settings - Fork 292
Open
Labels
Description
Description
Currently, the RabbitMQ module in @golevelup/nestjs does not support configuring the consumerTag when setting up a queue consumer. This feature would be beneficial for applications that need fine-grained control over consumer identifiers, especially in environments where multiple consumers operate on the same queue.
Proposed Solution
Add a consumerTag option to the queueOptions object in the RabbitMQ configuration. This tag should be passed to the underlying amqplib consumer configuration.
Example Usage
Here’s how the configuration could look with the new feature:
RabbitMQModule.forRootAsync(RabbitMQModule, {
useFactory: () => ({
uri: 'amqp://localhost:5672',
exchanges: [{ name: 'exchange_name', type: 'topic' }],
queues: [
{
name: 'queue_name',
options: {
consumerTag: 'custom_consumer_tag',
},
},
],
}),
});Benefits
- Enhanced Consumer Management: Allows applications to track and manage consumers more effectively.
- Best Practices: Supports RabbitMQ’s best practices for consumer identification.
- Ease of Use: Reduces the need for manual setup and channel management when working with consumers.
Alternatives
Developers can currently use the managedConnection to create channels manually, but this approach:
- Requires significant additional setup.