What is @bull-board/api?
@bull-board/api is a package that provides a user interface and API for managing and monitoring Bull queues. It allows developers to visualize and control their job queues, making it easier to track job statuses, retry failed jobs, and manage job lifecycles.
What are @bull-board/api's main functionalities?
Setting up Bull Board
This code sets up Bull Board with an Express server. It creates a Bull queue and integrates it with Bull Board, making the queue accessible via a web interface at '/admin/queues'.
const { createBullBoard } = require('@bull-board/api');
const { BullAdapter } = require('@bull-board/api/bullAdapter');
const Queue = require('bull');
const someQueue = new Queue('someQueueName');
const { router } = createBullBoard([
new BullAdapter(someQueue)
]);
// Express setup
const express = require('express');
const app = express();
app.use('/admin/queues', router);
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
Adding multiple queues
This code demonstrates how to add multiple Bull queues to Bull Board. It creates two queues and integrates them with Bull Board, making both queues accessible via the web interface.
const { createBullBoard } = require('@bull-board/api');
const { BullAdapter } = require('@bull-board/api/bullAdapter');
const Queue = require('bull');
const firstQueue = new Queue('firstQueue');
const secondQueue = new Queue('secondQueue');
const { router } = createBullBoard([
new BullAdapter(firstQueue),
new BullAdapter(secondQueue)
]);
// Express setup
const express = require('express');
const app = express();
app.use('/admin/queues', router);
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
Customizing Bull Board
This code shows how to customize Bull Board by dynamically adding or replacing queues. The `setQueues` and `replaceQueues` methods allow for flexible queue management.
const { createBullBoard } = require('@bull-board/api');
const { BullAdapter } = require('@bull-board/api/bullAdapter');
const Queue = require('bull');
const someQueue = new Queue('someQueueName');
const { router, setQueues, replaceQueues } = createBullBoard([
new BullAdapter(someQueue)
]);
// Express setup
const express = require('express');
const app = express();
app.use('/admin/queues', router);
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
// Later in the code, you can dynamically add or replace queues
const anotherQueue = new Queue('anotherQueueName');
setQueues([new BullAdapter(anotherQueue)]);
Other packages similar to @bull-board/api
bull-arena
Bull Arena is another package for managing and monitoring Bull queues. It provides a similar web interface for visualizing and controlling job queues. Compared to @bull-board/api, Bull Arena offers more customization options for the UI and supports multiple queue backends like Bull, Bee-Queue, and BullMQ.
bee-queue
Bee-Queue is a high-performance job queue for Node.js that is similar to Bull. While it does not provide a built-in UI like @bull-board/api, it focuses on speed and simplicity. Developers can use third-party tools or build custom interfaces to monitor Bee-Queue jobs.
agenda
Agenda is a job scheduling package for Node.js that uses MongoDB for persistence. It provides features for defining, scheduling, and managing jobs. While it does not offer a built-in UI like @bull-board/api, it is highly flexible and can be integrated with custom dashboards or third-party monitoring tools.