--- title: Ред порука image: /images/user-guide/emails/emails_header.png --- Header Queues facilitate async operations to be performed. Они се могу користити за обављање позадинских задатака као што је слање поздравног имејла приликом регистрације. Each use case will have its own queue class extended from `MessageQueueServiceBase`. Currently, we only support `bull-mq`[bull-mq](https://bullmq.io/) as the queue driver. ## Кораци за стварање и коришћење новог реда 1. Додајте име реда за нови ред у енам `MESSAGE_QUEUES`. 2. Обезбедите имплементацију фабрике реда са именом реда као токеном зависности. 3. Inject the queue that you created in the required module/service with the queue name as the dependency token. 4. Додајте класу радника са токенима за инжекцију као и код произвођача. ### Пример коришћења ```ts class Resolver { constructor(@Inject(MESSAGE_QUEUES.custom) private queue: MessageQueueService) {} async onSomeAction() { //business logic await this.queue.add(someData); } } //async worker class CustomWorker { constructor(@Inject(MESSAGE_QUEUES.custom) private queue: MessageQueueService) { this.initWorker(); } async initWorker() { await this.queue.work(async ({ id, data }) => { //worker logic }); } } ```