{"id":25961714,"url":"https://github.com/ttab/tenacious-q","last_synced_at":"2026-05-20T05:02:19.493Z","repository":{"id":15660718,"uuid":"18398137","full_name":"ttab/tenacious-q","owner":"ttab","description":"A more robust RabbitMQ experience.","archived":false,"fork":false,"pushed_at":"2023-10-17T12:45:23.000Z","size":520,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-10T19:47:46.692Z","etag":null,"topics":["jest","library","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ttab.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,"governance":null}},"created_at":"2014-04-03T09:42:56.000Z","updated_at":"2024-04-10T19:47:46.692Z","dependencies_parsed_at":"2023-01-11T20:23:44.458Z","dependency_job_id":"d6134e78-1a66-4843-9abb-55b930ec087d","html_url":"https://github.com/ttab/tenacious-q","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftenacious-q","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftenacious-q/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftenacious-q/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Ftenacious-q/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttab","download_url":"https://codeload.github.com/ttab/tenacious-q/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241913025,"owners_count":20041457,"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":["jest","library","typescript"],"created_at":"2025-03-04T19:41:11.643Z","updated_at":"2025-10-03T20:04:49.347Z","avatar_url":"https://github.com/ttab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"TenaciousQ\n==========\n\n![Build Status](https://ci2.tt.se/buildStatus/icon\\?job\\=ttab/tenacious-q/master)\n\n\nA simple mechanism for robust handling of messages on a AMQP\nqueue. Messages are not removed until ACKed, and if processing fails\nthe message is put away on a separate `retry queue` and will be\nretried at a later point in time. Messages that fail repeatedly will\neventually end up in a `fail queue`.\n\n## Usage\n\n```typescript\nimport { TenaciousQ } from 'tenacious-q'\n\nlet queue = await amqpc.queue('myqueue', ...)\nlet tq = new TenaciousQ(amqpc, queue, { \n  retry: { delay: 10, max: 60 },\n})\nr\nawait tq.subscribe(async (msg, headers, info, ack) =\u003e {\n  ... do stuff\n  ack.acknowledge() // or just return a promise; both work fine\n})\n```\n\n## Options\n\n`TenaciousQ()` accepts the follow `options` parameter\n\n  * `retry`\n    + `delay` - the delay (in seconds, not milliseconds) to wait before\n      retrying a failed message. The default is 10 seconds.\n    + `max` - the maximum time to wait (again, seconds not\n      milliseconds) before giving up on retrying a message. The\n      default is 1 minutes.\n  * `prefetchCount` - the number of messages to process in parallell. The\n    default is 1.\n\n## .subscribe([options, ] listener)\n\nThe subscribe function works pretty much like the normal\n`queue.subscribe(listener)` function. For each received message, the\nlistener will be invoked thus:\n\n    listener(msg, headers, info, ack)\n\n### Acknowledning and retrying \n\nThe `ack` object has three methods which can be called to acknowledge\nor retry a message:\n\n  * `ack.acknowledge()` - call this when you are done processing the\n    message.\n  * `ack.retry()` - if we've reached the maximum time limit, put the\n    message on the `fail queue`, otherwise put it on the `retry queue`\n    and attempt it again later.\n  * `ack.fail()` - give up on the message and put it directly on the\n    `fail queue`.\n\nHowever, if the listener doesn't explicitly call one of these methods,\n`TenaciousQ` will automatically call either `ack.retry()` (if the\nlistener threw an `Error` or returned a rejected promise) or\n`ack.acknowledge()` (if there were no errors).\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Ftenacious-q","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttab%2Ftenacious-q","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Ftenacious-q/lists"}