#BullAdapter
For the Bull queue library.
#Import
import { BullAdapter } from '@bull-board/api/bullAdapter';
// or
const { BullAdapter } = require('@bull-board/api/bullAdapter');#Usage
import { createBullBoard } from '@bull-board/api';
import { BullAdapter } from '@bull-board/api/bullAdapter';
import { ExpressAdapter } from '@bull-board/express';
import Queue from 'bull';
const myQueue = new Queue('my-queue', {
redis: { host: 'localhost', port: 6379 },
});
const serverAdapter = new ExpressAdapter();
serverAdapter.setBasePath('/admin/queues');
createBullBoard({
queues: [new BullAdapter(myQueue)],
serverAdapter,
});#Options
All options are optional.
| Option | Type | Default | Description |
|---|---|---|---|
readOnlyMode | boolean | false | Hides all queue and job actions. |
allowRetries | boolean | true | Shows or hides the retry buttons. Ignored when readOnlyMode is true. |
description | string | '' | Queue description text displayed in the UI. |
displayName | string | '' | Overrides the queue name shown in the UI. |
prefix | string | '' | Prepended to job names in the UI. |
delimiter | string | '' | Delimiter between the prefix and the job name. |
#Instance methods
adapter.setFormatter('name', (job) => `#${job.name}`);
adapter.setFormatter('data', (data) => redact(data));
adapter.setFormatter('returnValue', (value) => redact(value));
adapter.setFormatter('progress', (progress) => `${Math.round(progress)}%`);
adapter.setVisibilityGuard((request) => {
// return true to show this queue, false to hide it
return request.headers['x-tenant-id'] === 'acme';
});