{"id":23415246,"url":"https://github.com/bamlab/nest-rabbit-tasks","last_synced_at":"2025-08-17T07:03:13.379Z","repository":{"id":40932360,"uuid":"215599367","full_name":"bamlab/nest-rabbit-tasks","owner":"bamlab","description":"nest-rabbit-worker is a TaskQueue based upon RabbitMQ for NestJS","archived":false,"fork":false,"pushed_at":"2023-01-07T10:45:51.000Z","size":1462,"stargazers_count":30,"open_issues_count":22,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-06T06:47:03.780Z","etag":null,"topics":["amqp","amqp0-9-1","bam","nestjs","nodejs","rabbitmq","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/bamlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-16T16:55:04.000Z","updated_at":"2024-05-21T09:26:05.000Z","dependencies_parsed_at":"2023-02-06T23:01:58.421Z","dependency_job_id":null,"html_url":"https://github.com/bamlab/nest-rabbit-tasks","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/bamlab/nest-rabbit-tasks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fnest-rabbit-tasks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fnest-rabbit-tasks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fnest-rabbit-tasks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fnest-rabbit-tasks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bamlab","download_url":"https://codeload.github.com/bamlab/nest-rabbit-tasks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fnest-rabbit-tasks/sbom","scorecard":{"id":224902,"data":{"date":"2025-08-11","repo":{"name":"github.com/bamlab/nest-rabbit-tasks","commit":"cd519d51645519b16203821170c3e7649b0cc874"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/28 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":"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":"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":"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":"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":"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":"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: LICENCE:0","Info: FSF or OSI recognized license: MIT License: LICENCE: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 4 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"}},{"name":"Vulnerabilities","score":0,"reason":"111 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-cj7v-w2c7-cp7c","Warn: Project is vulnerable to: GHSA-4jpv-8r57-pv7j","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-42xw-2xvc-qx8m","Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-px4h-xg32-q955","Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4","Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653","Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj","Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67","Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w","Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2","Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442","Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc","Warn: Project is vulnerable to: GHSA-rqff-837h-mm52","Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2","Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j","Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T03:32:43.310Z","repository_id":40932360,"created_at":"2025-08-17T03:32:43.310Z","updated_at":"2025-08-17T03:32:43.310Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270816216,"owners_count":24650759,"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-08-17T02:00:09.016Z","response_time":129,"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":["amqp","amqp0-9-1","bam","nestjs","nodejs","rabbitmq","typescript"],"created_at":"2024-12-22T21:14:07.257Z","updated_at":"2025-08-17T07:03:13.345Z","avatar_url":"https://github.com/bamlab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nest-rabbit-tasks\n\n`nest-rabbit-tasks` is a `TaskQueue` based upon `RabbitMQ` for `NestJS`.\n\n![NPM](https://img.shields.io/npm/l/nest-rabbit-tasks?style=for-the-badge)\n\n![David](https://img.shields.io/david/bamlab/nest-rabbit-tasks?style=for-the-badge) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/nest-rabbit-tasks?style=for-the-badge)\n\n![CircleCI](https://img.shields.io/circleci/build/github/bamlab/nest-rabbit-tasks/master?style=for-the-badge\u0026token=87ce85715999b1f7547ed34c569cb60d339f9894)\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bamlab_nest-rabbit-tasks\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=bamlab_nest-rabbit-tasks) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=bamlab_nest-rabbit-tasks\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=bamlab_nest-rabbit-tasks) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=bamlab_nest-rabbit-tasks\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=bamlab_nest-rabbit-tasks) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=bamlab_nest-rabbit-tasks\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=bamlab_nest-rabbit-tasks)\n\n![rabbit](https://images.unsplash.com/photo-1480554840075-72cbdabbf689?ixlib=rb-1.2.1\u0026auto=format\u0026fit=crop\u0026w=3300\u0026q=80)\n\n## Motivation\n\nBy working hard on abstracting `NestJS` injection and `RabbitMQ` connection, we wanted to make it easy to do background tasks in `NestJS`.\n\n`nest-bull` is a reference in this domain: it use `bull` and `redis` to provide the task queue. Moreover `nest-bull` and `bull` are the state of art about\nhow TaskQueue complexity can be hidden and abstracted. With them, building a queue is actually fun.\n\nHowever, complex system may need other technologies than `redis`: `RabbitMQ` provides more features, such as exchange (to allow task routing).\n\nWe needed it on a project, so here it is made available for you.\n\n## Disclaimer\n\nThis is _beta quality_ software. We just started it so it has probably a few bugs.\n\nWe are actively working on it so it may break without notice / API may change.\n\n:warning: **Use with caution**, be ready to pin a version and make some modification on the code :warning:\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://twitter.com/TychoTa\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/13785185?v=4\" width=\"100px;\" alt=\"Tycho Tatitscheff\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eTycho Tatitscheff\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/bamlab/nest-rabbit-tasks/commits?author=tychota\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/bamlab/nest-rabbit-tasks/commits?author=tychota\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#ideas-tychota\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"#infra-tychota\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/MattAgn\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/32499425?v=4\" width=\"100px;\" alt=\"MattAgn\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMattAgn\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/bamlab/nest-rabbit-tasks/commits?author=MattAgn\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/bamlab/nest-rabbit-tasks/commits?author=MattAgn\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#ideas-MattAgn\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.\nContributions of any kind welcome!\n\n## Get Started\n\nDeclare the module:\n\n```ts\nimport { Module } from '@nestjs/common';\nimport { NestRabbitTasksModule } from 'nest-rabbit-tasks';\n\n// Import the worker.\nimport { EmailWorker } from './worker/email.worker';\n// And import some services.\nimport { SMTPService } from './service/smtp.service';\n\n@Module({\n  imports: [\n    // Note that there is also a `registerAsync` method\n    // that allows the parameters to depend on an injected configService.\n    // You can have a look at the interface to see what options it takes.\n    NestRabbitTasksModule.registerSync({\n      // That is not the name of RabbitMQ queue\n      // but an unique reference that identify the queue and the worker\n      // and allow us to link the conf here and the worker implementation there\n      reference: 'worker-email-queue',\n      // Queue or exchange (but exchange are not implemented yet ^^).\n      entityType: 'queue',\n      // AMQP connection/channel wide options.\n      amqpOptions: { connectionUrl: 'amqp://localhost:5672' },\n      // Module option that dictate the worker behavior\n      globalOptions: {\n        // By default RabbitMQ create queue if the queue doesn't exist\n        // By setting `{ immutableInfrastructure: true }` will throw if the queue does not exist\n        // Note that this is not yet implemented yet but will be pretty soon\n        immutableInfrastructure: true,\n        // How many messages the Worker should take.\n        // Increasing it increase the throughput but decrease the consistency\n        prefetchSize: 1,\n      },\n      // Definition of the queue and queue specific options\n      // such as `single-active-consumer`\n      entity: { queueName: 'worker.queue.1', queueOptions: {} },\n      // Worker used to handle the AMQP message\n      worker: EmailWorker,\n    }),\n  ],\n  // Here you should import the worker (EmailWorker)\n  // and other service you need\n  providers: [EmailWorker, SMTPService],\n})\nexport class AppModule {}\n\n// ---\n\n// in main.js\nimport { NestFactory } from '@nestjs/core';\n\nasync function bootstrap() {\n  // Start the module like always\n  const app = await NestFactory.create(AppModule);\n  // And launch it.\n  // Having an HTTP port is useful to configure an health-check route\n  await app.listen(3000);\n}\n```\n\nand create a worker:\n\n```ts\nimport { RabbitWorker, RabbitTasksWorker, RabbitTasksWorker } from 'nest-rabbit-tasks';\n\n// You can specify what the Event looks like.\n// By default it is any.\ninterface Event {\n  name: string;\n  recipient: string[];\n  cc?: string[];\n  bcc?: string[];\n  content: string;\n}\n\n@RabbitTasksWorker({ reference: 'worker-email-queue' })\nexport class EmailWorker extends RabbitWorker\u003cEvent\u003e {\n  // Please do dependency injection\n  // and inject what need for the worker to work\n  public constructor(private readonly smtpService: SMTPService) {}\n\n  // This method is mandatory\n  public async handleMessage(data: Event, message: RabbitTasksWorker\u003cEvent, void\u003e) {\n    if (data.name === 'send-mail') {\n      await this.smtpService.sendEmail(data.recipient, data.cc, data.bcc, data.content);\n      // Acknowledge the message to remove it from the queue\n      message.ack();\n    } else {\n      log.error('unknown event');\n      if (message.getHeader('x-retries') \u003c 3) {\n        // Non acknowledge the message but with retry\n        // to requeue it and process it later\n        message.nack(true);\n      } else {\n        // Non acknowledge the message without retry\n        // to remove it from the queue\n        message.nack(false);\n      }\n    }\n  }\n}\n```\n\n## Advanced usage\n\n### Async configuration\n\nWhy: your configuration may be dynamic, depends on env variable or API calls.\n\n```ts\n@Module({\n  imports: [\n    NestRabbitTasksModule.registerAsync({\n      // The reference must be static and unique\n      reference: 'toto',\n      // Same for the entity type\n      entityType: 'queue',\n      // The handler is static too\n      // (but that is not a mandatory constraint in the code, let me know if you have usages that)\n      // (... requires it to be dynamic. I just found it made more sense like this in my use cases.)\n      worker: TestWorker,\n      // The rest of the options are dynamic\n      // (We only provide `useFactory` for now but `useExisting` and `useClass` can be easily implemented)\n      useFactory: async (configService: ConfigService) =\u003e {\n        const queueName = await configService.getQueueName();\n        return {\n          entity: { queueName },\n          amqpOptions: { connectionUrl: 'amqp://localhost:5672' },\n          globalOptions: { immutableInfrastructure: true, prefetchSize: 1 },\n        };\n      },\n      // For it to work you have to import a module, eg. a config module\n      // that export a service, eg. a config service\n      // and inject the configService, so `useFactory` can resolve it\n      imports: [ConfigModule],\n      inject: [ConfigService],\n    }),\n  ],\n  providers: [TestWorker],\n})\nexport class AppModule {}\n```\n\n## Road-map\n\n- [x] implement the `immutableInfrastructure` mode\n- [x] connect Rabbit logger to nest Logger and improve debug logs\n- [x] properly check that config is correct and report error if not\n- [x] implement async configuration (`registerAsync`)\n- [x] prevent `Haredo` deps to leak\n- [ ] implement `@OnEvent(rabbitEventName: string)` to decorate a method of the `Worker` that will be call when rabbitEventName is emitted in the queue\n- [ ] work on quality (unit tests, E2E tests)\n- [ ] improve the doc (`registerAsync`)\n\n- [ ] implement an `Exchange` class (so users can publish to exchange using this)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbamlab%2Fnest-rabbit-tasks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbamlab%2Fnest-rabbit-tasks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbamlab%2Fnest-rabbit-tasks/lists"}