{"id":15664750,"url":"https://github.com/zaiste/blezer","last_synced_at":"2025-10-24T05:17:55.424Z","repository":{"id":40617259,"uuid":"74387128","full_name":"zaiste/blezer","owner":"zaiste","description":":confetti_ball: :battery: Simple background job/task processing queue for Node.js (\u003e= 7.6) using `cluster` \u0026 separate Node processes.","archived":false,"fork":false,"pushed_at":"2022-12-06T20:32:29.000Z","size":616,"stargazers_count":16,"open_issues_count":18,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-06T15:40:43.657Z","etag":null,"topics":["background-jobs","background-worker","cluster","job","job-queue","nodejs","queue","worker","worker-queue"],"latest_commit_sha":null,"homepage":"https://blezer.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zaiste.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-21T17:15:57.000Z","updated_at":"2023-11-02T03:25:25.000Z","dependencies_parsed_at":"2023-01-23T15:16:32.436Z","dependency_job_id":null,"html_url":"https://github.com/zaiste/blezer","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/zaiste/blezer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fblezer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fblezer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fblezer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fblezer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaiste","download_url":"https://codeload.github.com/zaiste/blezer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fblezer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280742545,"owners_count":26382929,"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-24T02:00:06.418Z","response_time":73,"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":["background-jobs","background-worker","cluster","job","job-queue","nodejs","queue","worker","worker-queue"],"created_at":"2024-10-03T13:44:03.455Z","updated_at":"2025-10-24T05:17:55.383Z","avatar_url":"https://github.com/zaiste.png","language":"JavaScript","readme":"# blezer \n\n[![npm](https://img.shields.io/npm/v/blezer.svg)](https://www.npmjs.com/package/blezer)\n[![npm](https://img.shields.io/npm/dm/blezer.svg)](https://www.npmjs.com/package/blezer)\n\nBlezer is a simple background job/task processing queue for Node.js (\u003e= 7.6) using `cluster` \u0026 separate Node processes, powered by Redis.\n\n## Features \n\n- [x] each worker runs its tasks in a separate Node.js process\n- [x] RESTful JSON API\n- [x] integrated UI\n- [x] logging per job/task\n- [ ] delay job/task execution\n- [ ] job/task expiry value for being in active state\n\n## Install\n\n    npm install -g blezer\n\n## Usage \n\n### Step 1: Create a task\n\nEach job triggers an execution of a *Task* i.e. a recipe what to do for that job. It is defined as a `class` with `perform` method. `Task` corresponds to `Worker` from similar projects such as [resque][1] or [sidekiq][2]. It is named this way to avoid the clash with `cluster` workers.\n\n```js\nconst { Task } = require('blezer');  \n\nclass LoopTask extends Task {\n  perform(args) {\n    this.log(`Running inside: ${process.pid}`);\n    this.log(`Args: ${args}`);\n\n    let progress = 0;\n    for (var i = 0; i \u003c 1e10; i++) {\n      if (i % 1e8 == 0) {\n        this.log(i)\n        this.progress(progress, 100);\n        progress++;\n      }\n    }\n  }\n}\n\nmodule.exports = LoopTask\n```\n\n### Step 2: Run the server\n\nPut your tasks in `tasks/` directory and run\n\n    blezer start\n\nBy default, it checks available number of cores and it instantiates the number of Node processes accordingly. You can specify number of process by hand using `-c` option. Type `blezer start --help` to see all available options.\n\n### Step 3: Enqueue a job\n\nYou can enqueue a job to perform given task from a JavaScript application\n\n```js\nconst { enqueue } = require('blezer');\n\nenqueue('LoopTask', '[1, 2, 3]');\n```\n\nBy default, the `enqueue` function puts the new job on `default` queue; this can be changed with the `name` parameter from `options`.\n\n```js\nenqueue('LoopTask', '[1, 2, 3]', { name: 'high' });\n```\n\nA job can be scheduled to run at a specific time using `scheduledAt` parameter.\n\n```js\nenqueue('LoopTask', '[1, 2, 3]', { name: 'high', scheduledAt: Date.now() + Sugar.Number.days(4) });\n```\n\nIt is also possible to enqueue a job through Blezer REST API\n\n    http POST :3000/api/enqueue task=LoopTask args='[1,2,3]'\n\n### (optional) Step 4: Check the progress via UI\n\nGo to `localhost:3000` to check the job proegress through Blezer UI.\n\n[1]: https://github.com/resque/resque\n[2]: https://github.com/mperham/sidekiq\n\n## Blezer UI\n\nBlezer comes with a built-in web UI that allows to quickly see the status of all jobs. Here's a preview of what it looks like:\n\n![Blezer UI](https://github.com/zaiste/blezer/raw/master/blezer-ui.jpg)\n\n### Environments\n\nYou can distinguish visually the UI between `staging` and `production` environments by specifying `BLEZER_ENV` variable accordingly. You can set this variable when launching Blezer with `blezer start` e.g.\n\n```\nBLEZER_ENV=production blezer start\n```\n\nIt will add a small color bar at the top to help you identify at a glance which UI instance you are currently using.\n\n---\n\n## Concepts\n\n### Queues\n\n*Queue* is a list of *Job* items, stored so as to be retrievable and handled in the order of insertion. You can create a *Queue* by giving it a name. This is a lower level API which usually shouldn't be used directly - it's advised to use `enqueue` helper. \n\n```js\nconst { Queue } = require('blezer');\nconst highQueue = new Queue('high');\n```\n\n### Logging\n\nYou can log on per job/task basis by using `this.log(message)` method, where `message` is an object or a string.\n\n```\nthis.log(\"This is my log message\");\nthis.log({ a: 1, b: 2});\n```\n\n### Create tasks from CLI\n\nYou can create a task in `tasks` using CLI\n\n```\nblezer create foo\n```\n\nThis command will create `FooTask.js` task in `tasks/` directory.\n\n## Roadmap\n\nBlezer keeps track of the upcoming fixes and features on GitHub Projects: [Blezer Roadmap](https://github.com/zaiste/blezer/projects/1)\n\n## Bug reports\n\nWe use *Github Issues* for managing bug reports and feature requests. If you run\ninto problems, please search the *issues* or submit a new one here:\nhttps://github.com/zaiste/blezer/issues\n\nDetailed bug reports are always great; it's event better if you are able to\ninclude test cases.\n\n## Roadmap\n\n- [ ] visualisation with Clui https://github.com/nathanpeck/clui\n\n## Contributing\n\n- run the code through `prettier`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaiste%2Fblezer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaiste%2Fblezer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaiste%2Fblezer/lists"}