adonis-queues

1.0.0 • Public • Published

Installation

Using npm:

$ npm i git+https://github.com/FetchSkyTech/adonis-queues.git --save

In start/app.js:

  • Add "adonis-queue-fs/providers/QueueProvider" in providers array
  • Add "Adonis/Commands/Queue:Init", "Adonis/Commands/Queue:Work" & "Adonis/Commands/Queue:Job" in commands array.

Execute the following command to generate the config file

$ adonis queue:init

In config/queue.js:

  • Put your queue server configuration

Execute the following command to create a queueable job

$ adonis queue:create-job MyJob

In App/Jobs/MyJob.js:

  • Fill up the handle function for the worker as per the requirement

How it works?

// Create job's instance with JSON/String as an argument
const job = new MyJob(data);
// It will push the job into the queue
job.dispatch(queue, connection);

Start Worker:

Execute the following command to start consumption

$ adonis queue:work [connection] --queue=[queue]

Note:

  • Currently, it only supports RabbitMQ.
  • Supports multiple queue server connections as well.

Package Sidebar

Install

npm i adonis-queues

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

18.4 kB

Total Files

15

Last publish

Collaborators

  • fetchsky