0.0.8 • Published 2 years ago

job-handler v0.0.8

Weekly downloads
-
License
CC BY-NC 3.0 FR
Repository
-
Last release
2 years ago

job-handler

This lib allows you to handle async jobs in a micro-services architecture, using RabbitMq and MongoDB.

Usage

const jobHandler = await JobHandler.create({
    rabbitMqUrl: 'amqp://user:password@address:5672',
    jobApiUrl: 'http://my-job-api-url',
});

await jobHandler.addHandler('job-name', async (job) => {
    // You job handler here
});

await jobHandler.addHandler('other-job-name', async (job) => {
    // You job handler here
}); 

JobHandler parameters :

  • rabbitMqUrl (string): Connection URL for your RabbitMQ instance.
  • jobApiUrl (string): URL of the Job API to get jobs and update their status.
  • maxParallelJobs (number, default = 0): Maximum number of jobs which can be processed simultaneously (global to all handlers you add)
  • logger (Logger, default = no logs): You can provide an implementation of the interface Logger to display logs of the JobHandler
0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago