moleculer-queues
Redis-based queue for moleculerjs using Bull.
This package was created with the purpose of solving some problems with the original "moleculer-bull" package, with a new logic this module allows to run jobs manually using "methods" this to avoid "duplication of jobs when the service starts" , it also supports repetitive jobs just like "bull" does, each task is restarted every time the service stops thus avoiding task overload and "double-run"
The main idea of this package is to allow it to support multiple types of "queue" like (bee-queue, cron, etc) in the same way as a task monitor, so far it supports only "bull"
Installation
Install my-project with npm
npm install moleculer-queues --save
or
yarn add moleculer-queues
Usage/Examples
const MoleculerQueues = require('moleculer-queues');
broker.createService({
name: 'service-example',
mixins: [MoleculerQueues('PrefixName', { redis: 'redis://127.0.0.1:6379' })],
methods: {
yourMethod(payload) {
this.addJobQueue('SendEmail', {
});
},
},
queues: [
{
name: 'SendEmail',
async handler(job, done) {
this.logger.info('Sending notification..');
return done(null, {
message: 'Notification sent!',
});
},
},
],
});
To-do