For the complete documentation index, see llms.txt. This page is also available as Markdown.

Producers

Producers

Job producers add jobs to queues. Producers are typically application services (Nest providers). To add jobs to a queue, first inject the queue into the service as follows:

import { Injectable } from '@nestjs/common';
import { QueuePro } from 'taskforcesh/bullmq-pro';
import { InjectQueue } from '@taskforcesh/nestjs-bullmq-pro';

@Injectable()
export class AudioService {
  constructor(@InjectQueue('audio') private audioQueue: QueuePro) {}
}

The @InjectQueue() decorator identifies the queue by its name, as provided in the registerQueue().

Now, add a job by calling the queue's add() method.

const job = await this.audioQueue.add({
  foo: 'bar',
});

Flow Producers

To add flows, first inject the flow producer into the service as follows:

The @InjectFlowProducer() decorator identifies the flow producer by its name, as provided in the registerFlowProducer().

Now, add a flow by calling the flow producer's add() method.

Read more:

Last updated

Was this helpful?