{"id":13817602,"url":"https://github.com/nrempel/adonis-kue","last_synced_at":"2025-05-08T23:08:51.266Z","repository":{"id":57098359,"uuid":"61677471","full_name":"nrempel/adonis-kue","owner":"nrempel","description":"An AdonisJS provider for Kue","archived":false,"fork":false,"pushed_at":"2020-02-18T19:09:31.000Z","size":170,"stargazers_count":87,"open_issues_count":7,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-24T17:46:53.086Z","etag":null,"topics":["adonis","adonisjs","job","kue","queue","worker"],"latest_commit_sha":null,"homepage":"https://github.com/nrempel/adonis-kue","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/nrempel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-22T00:53:39.000Z","updated_at":"2024-02-14T17:14:27.000Z","dependencies_parsed_at":"2022-08-20T16:51:08.045Z","dependency_job_id":null,"html_url":"https://github.com/nrempel/adonis-kue","commit_stats":null,"previous_names":["nrempel/adonis-kue-provider"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrempel%2Fadonis-kue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrempel%2Fadonis-kue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrempel%2Fadonis-kue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrempel%2Fadonis-kue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nrempel","download_url":"https://codeload.github.com/nrempel/adonis-kue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252524542,"owners_count":21762109,"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","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":["adonis","adonisjs","job","kue","queue","worker"],"created_at":"2024-08-04T06:00:51.812Z","updated_at":"2025-05-08T23:08:51.234Z","avatar_url":"https://github.com/nrempel.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# Adonis Kue Provider\n\nA [Kue](https://github.com/Automattic/kue) provider for the Adonis framework.\n\nThis library provides an easy way to get started with an asynchronous job queue for AdonisJS.\n\n## Install\n\n```\nnpm install --save adonis-kue\n```\n\n## Configure\n\nRegister the kue provider in `start/app.js`:\n\n```javascript\nconst providers = [\n  ...\n  'adonis-kue/providers/KueProvider'\n]\n```\n\nRegister the commands provider in `start/app.js`:\n\n```javascript\nconst aceProviders = [\n  ...\n  'adonis-kue/providers/CommandsProvider'\n]\n```\n\nRegister the jobs in `start/app.js`:\n\n```javascript\nconst jobs = [\n  ...\n  'App/Jobs/Example'\n]\n```\n\nAnd then export the `jobs` array:\n\n```js\nmodule.exports = { providers, aceProviders, aliases, commands, jobs }\n```\n\nAdd a configuration file in `config/kue.js`. For example:\n\n```javascript\n'use strict'\n\nconst Env = use('Env')\n\nmodule.exports = {\n  // redis connection\n  connection: Env.get('KUE_CONNECTION', 'kue')\n}\n```\n\n## Usage\n\n### Command List\nCommand               | Description\n:---------------------|:-----------\n `adonis kue:listen`  | Starting the listener\n `adonis make:job`    | Make a new Job (Queue)\n\n### Starting the listener\n\nStarting an instance of the kue listener is easy with the included ace command. Simply run `./ace kue:listen` or `adonis kue:listen`.\n\n### Creating your first job\n\n\nThey expose the following properties:\n\n| Name        | Required | Type      | Static | Description                                           |\n|-------------|----------|-----------|--------|-------------------------------------------------------|\n| concurrency | false    | number    | true   | The number of concurrent jobs the handler will accept |\n| key         | true     | string    | true   | A unique key for this job                             |\n| handle      | true     | function  | false  | A function that is called for this job.               |\n\n[Here's an example.](examples/app/Jobs/Example.js)\n\n### Dispatching jobs\n\nNow that your job listener is running and ready to do some asynchronous work, you can start dispatching jobs.\n\n```javascript\nconst kue = use('Kue')\nconst Job = use('App/Jobs/Example')\nconst data = { test: 'data' } // Data to be passed to job handle\nconst priority = 'normal' // Priority of job, can be low, normal, medium, high or critical\nconst attempts = 1 // Number of times to attempt job if it fails\nconst remove = true // Should jobs be automatically removed on completion\nconst jobFn = job =\u003e { // Function to be run on the job before it is saved\n  job.backoff()\n}\nconst job = kue.dispatch(Job.key, data, { priority, attempts, remove, jobFn })\n\n// If you want to wait on the result, you can do this\nconst result = await job.result\n```\n\n## Thanks\n\nSpecial thanks to the creator(s) of [AdonisJS](http://adonisjs.com/) for creating such a great framework.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrempel%2Fadonis-kue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnrempel%2Fadonis-kue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrempel%2Fadonis-kue/lists"}