{"id":31936447,"url":"https://github.com/stitchng/adonis-queue","last_synced_at":"2025-10-14T07:42:48.069Z","repository":{"id":57173659,"uuid":"161167993","full_name":"stitchng/adonis-queue","owner":"stitchng","description":"An addon/plugin package to provide driver-based job queueing services in AdonisJS 4.0+","archived":false,"fork":false,"pushed_at":"2020-04-22T08:41:40.000Z","size":169,"stargazers_count":34,"open_issues_count":6,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-29T20:54:00.093Z","etag":null,"topics":["adonisjs","bee-queue","job","jobs","queues","redis","worker"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stitchng.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":"coolcodes","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-12-10T11:58:45.000Z","updated_at":"2024-08-19T10:02:50.000Z","dependencies_parsed_at":"2022-08-24T13:31:10.001Z","dependency_job_id":null,"html_url":"https://github.com/stitchng/adonis-queue","commit_stats":null,"previous_names":["stitchng/adonis-redis-queue"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/stitchng/adonis-queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchng%2Fadonis-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchng%2Fadonis-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchng%2Fadonis-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchng%2Fadonis-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stitchng","download_url":"https://codeload.github.com/stitchng/adonis-queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchng%2Fadonis-queue/sbom","scorecard":{"id":853482,"data":{"date":"2025-08-11","repo":{"name":"github.com/stitchng/adonis-queue","commit":"5f6ee19f3edd53ec6234ec4b4e777d3bec337d6e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T23:10:40.496Z","repository_id":57173659,"created_at":"2025-08-23T23:10:40.496Z","updated_at":"2025-08-23T23:10:40.496Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018217,"owners_count":26086308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adonisjs","bee-queue","job","jobs","queues","redis","worker"],"created_at":"2025-10-14T07:42:46.073Z","updated_at":"2025-10-14T07:42:48.063Z","avatar_url":"https://github.com/stitchng.png","language":"JavaScript","funding_links":["https://patreon.com/coolcodes","https://www.patreon.com/coolcodes/"],"categories":[],"sub_categories":[],"readme":"# adonis-queue\nAn addon/plugin package to provide driver-based job queueing services in AdonisJS 4.0+\n\n[![NPM Version][npm-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n[![Coveralls][coveralls-image]][coveralls-url]\n\n\u003cimg src=\"http://res.cloudinary.com/adonisjs/image/upload/q_100/v1497112678/adonis-purple_pzkmzt.svg\" width=\"200px\" align=\"right\" hspace=\"30px\" vspace=\"140px\"\u003e\n\n## Getting Started\n```bash\n\n    adonis install adonisjs-queue\n\n```\n\n## Usage\n\n\u003eAdd a job file to the jobs folder using the command. The command below creates the file `app/Jobs/SendEmail.js`. The queue flag in the command is for setting the queue priority channel. The queue flag has only 2 possible values:  _high_ and _low_\n\n```bash\n\n\t$ adonis make:job SendEmail\n\n\t$ adonis make:job SendEmail --queue=low\n\n```\n\n\u003eOR\n\n```bash\n\n\t$ node ace make:job SendEmail\n\n```\n\n## Installation Instructions\n\nSee the [_instructions.md_](https://github.com/stitchng/adonis-queue/blob/master/instructions.md) file for the complete installation steps and follow as stated.\n\n## Writing A Job\n\n```js\n/** @type {typeof import('adonisjs-queue/src/Job')} */\nconst Job = use('Job')\n\n/** @type {typeof import('@adonisjs/mail/src/Mail')} */\nconst Mail = use('Mail')\n\nclass SendEmail extends Job {\n\t\n\tget queue(){\n\t\treturn 'low'\n\t}\n    \n\tconstructor(emailAddress, emailFrom, emailSubject, emailBody) {\n\t\tsuper(arguments)\n\n\t\tthis.timeOut = 100; // seconds\n\t\tthis.retryCount = 0;\n\t\tthis.retryUntil = 200; // seconds\n\t\tthis.delayUntil = Date.parse('2038-01-19T03:14:08.000Z') // optional, omit this line if not required\n\t}\n\n\tasync handle(link, done) {\n\t\t//....\n\t\tconsole.log(`Job [${this.constructor.name}] - handler called: status=running; id=${this.id} `)\n    \n\t\tawait link.reportProgress(10)\n\n\t\tlet _data = link.data // arguments passed into the constructor\n\t\tlet error = null\n\t\tlet result = null\n\n\t\ttry{\n\t\t\tresult = await Mail.send(_data.emailBody, {gender:'F', fullname:\"Aisha Salihu\"}, (message) =\u003e {\n\t\t\t\tmessage.to(_data.emailAddress) \n\t\t\t\tmessage.from(_data.emailFrom) \n\t\t\t\tmessage.subject(_data.emailSubject)\n\t\t\t})\n\t\t\tawait link.reportProgress(50)\n\t\t}catch(err){\n\t\t\terror = err\n\t\t\tresult = undefined\n\t\t\tawait link.reportProgress(50)\n\t\t}finally{\n\t\t\tawait link.reportProgress(100)\n\t\t}\n\t\t\n\t\treturn new Promise((resolve, reject) =\u003e {\n\t\t\terror === null ? resolve(result) : reject(error)\n\t\t});\n\t}\n\n\tprogress(progress) {\n\n\t\tconsole.log(`Job [${this.constructor.name}] - progress:${progress}%: status=running; id=${this.id} `)\n\t}\n\n\tfailed(error) {\n    \n\t\tconsole.log(`Job [${this.constructor.name}] - status:failed; id=${this.id} `, error.message)\n\t\t\n\t\tthis.detach() // remove the job from the queue (when the job fails after all retries)\n\t}\n\t\n\tretrying(error){\n\t\n\t\tconsole.log(`Job [${this.constructor.name}] - status:retrying; id=${this.id} `, error.message)\n\t}\n\t\n\tsucceeded(result){\n\t\n\t\tconsole.log(`Job [${this.constructor.name}] - status:succeeded; id=${this.id} `, result)\n\t}\n}\n\nmodule.exports = SendEmail\n\n```\n\n\u003eOpen the `start/events.js` file of an **AdonisJS Framework** installation and add the following code to it (This package encourages the use of the standard event bus for **AdonisJS**)\n\n```js\n\n'use strict'\n\n/** @type {typeof import('@adonisjs/framework/src/Event')} */\nconst Event = use('Event')\n\n/** @type {typeof import('adonisjs-queue/src/Queue')} */\nconst Queue = use('Queue')\n\nconst SendEmail = use('App/Jobs/SendEmail')\n\nEvent.on('user_registered', async ( _email ) =\u003e {\n\t// dispatch to the \"high\" priority queue\n\n    await Queue.select('high').andDispatch(new SendEmail(\n\t\t_email,\n\t\t'support@example.com',\n\t\t'YOU ARE WELCOME',\n\t\t'emails.template_1' // AdonisJS view template file: \"resources/views/emails/template_1.edge\"\n    ));\n    \n    // implicitly calls select('high')\n    await Queue.dispatch(new SendEmail(\n    \t\t_email,\n\t\t'support@example.com',\n\t\t'NEXT STEPS',\n\t\t'emails.template_2' // AdonisJS view template file: \"resources/views/emails/template_2.edge\"\n    ));\n})\n\n```\n\n\u003eThen, go to the `start/routes.js` file of an **AdonisJS Framework** installation and add the following code to it\n\n```js\n\n/** @type {typeof import('@adonisjs/framework/src/Route/Manager')} */\nconst Route = use('Route')\n\nRoute.post('user/register/:type', ({ request, params: { type }, respopnse }) =\u003e {\n\tconst body = request.post()\n\n\tEvent.fire('user_registered', 'queensaisha04@gmail.com') // Invoke the 'SendEmail' Job (to send an email) via the Event Bus\n\n\tif (request.format() === 'json') {\n  \t\treturn response.status(200).json({\n\t\t  \tstatus:'success'\n\t\t})\n\t}else{\n\t\treturn response.send('success')\n\t}\n})\n```\n\n## Possible Gocthas\n\nIf the `select()` method is explicitly called before a (chained) call `andDispatch()` OR `dispatch()` is made on the `Queue` object, the queue getter value on a **job** instance (`job.queue`) is automatically overridden by the value passed to the *select* method like so `select('low')`. So, be well aware of how calling `select` explicitly affects things.\n\n## More\n\n\u003eYou can also access the queue instance via the **AdonisJS Http Context** in a controller/middleware\n\n```js\n\n'use strict'\n\nconst SendEmail = use('App/Jobs/SendEmail')\n\nclass WorksController {\n\n\tasync sendEmail({ request, queue, session }){\n\t\n\t\tlet tenant_id = session.get('tenant_id')\n\t\t\n\t\tlet { email } = request.only([\n\t\t\t'email'\n\t\t])\n\t\t\n\t\tawait queue.dispatch(new SendEmail( // dispatch to the \"low\" priority queue\n\t\t\temail,\n\t\t\t'support@example.com',\n\t\t\t'YOU ARE WELCOME',\n\t\t\t'emails.template' // AdonisJS view template file in \"resources/views\"\n\t\t))\n\t}\n}\n\nmodule.exports = WorksController\n\n```\n\n## License\n\nMIT\n\n## Running Tests\n```bash\n\n    npm i\n\n```\n\n```bash\n\n    npm run lint\n    \n    npm run test\n\n```\n\n## Credits\n\n- [Ifeora Okechukwu](https://twitter.com/isocroft)\n- [Ahmad Abdul-Aziz](https://instagram.com/dev_amaz)\n\n## Contributing\n\nSee the [CONTRIBUTING.md](https://github.com/stitchng/adonis-queue/blob/master/CONTRIBUTING.md) file for info\n\n[npm-image]: https://img.shields.io/npm/v/adonisjs-queue.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/adonisjs-queue\n\n[travis-image]: https://img.shields.io/travis/stitchng/adonis-queue/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/stitchng/adonis-queue\n\n[coveralls-image]: https://img.shields.io/coveralls/stitchng/adonis-queue/master.svg?style=flat-square\n\n[coveralls-url]: https://coveralls.io/github/stitchng/adonis-queue\n\n## Support \n\n**Coolcodes** is a non-profit software foundation (collective) created by **Oparand** - parent company of StitchNG, Synergixe based in Abuja, Nigeria. You'll find an overview of all our work and supported open source projects on our [Facebook Page](https://www.facebook.com/coolcodes/).\n\n\u003eFollow us on facebook if you can to get the latest open source software/freeware news and infomation.\n\nDoes your business depend on our open projects? Reach out and support us on [Patreon](https://www.patreon.com/coolcodes/). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstitchng%2Fadonis-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstitchng%2Fadonis-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstitchng%2Fadonis-queue/lists"}