Inject a queue sender by name.
Queue names are typed via module augmentation of QueueNames interface. The queue name serves as both the identifier and the DI injection token.
Queue name (typed with autocomplete if QueueNames is augmented)
Parameter decorator for constructor injection
// Direct injection by queue nameconstructor( @InjectQueue('notifications-queue') private queue: IQueueSender) {}// Usageawait this.queue.dispatch({ type: 'email.send', payload: { to: 'user@example.com', subject: 'Hello' }}) Copy
// Direct injection by queue nameconstructor( @InjectQueue('notifications-queue') private queue: IQueueSender) {}// Usageawait this.queue.dispatch({ type: 'email.send', payload: { to: 'user@example.com', subject: 'Hello' }})
The queue must be registered via QueueModule.registerQueue(name) before injection. For module-internal queue bindings (e.g., EmailModule), use @inject(TOKEN) with useExisting provider binding instead.
QueueModule.registerQueue(name)
@inject(TOKEN)
useExisting
Inject a queue sender by name.
Queue names are typed via module augmentation of QueueNames interface. The queue name serves as both the identifier and the DI injection token.