Skip to main content

Named workstreams

Named workstreams isolate certain work within a dedicated BullMQ Queue. Not only does this enable control over resource allocation to certain work, but it organizes visualization when using a dashboard such as the Taskforce BullMQ dashboard or the open source Express Bull Dashboard:

Bull Dashboard

Configure named workstreams in conf/workers.ts by adding a namedWorkstreams key:

  workersApp.set('background', {
...

namedWorkstreams: [
{
name: 'Iterable',
// https://docs.bullmq.io/guide/parallelism-and-concurrency
workerCount: 1,
concurrency: 10,
},
{
name: 'Twilio',
// https://docs.bullmq.io/guide/parallelism-and-concurrency
workerCount: 1,
concurrency: 10,
},
],
})

...
})

Then set the workstream used by the class:

class IntercomSync extends ApplicationBackgroundedService {
public static get backgroundJobConfig(): BackgroundJobConfig<ApplicationBackgroundedService> {
return { workstream: 'Iterable' }
}
}