{"id":17069618,"url":"https://github.com/freethenation/rabbit-qps-exchange","last_synced_at":"2026-02-06T06:02:46.179Z","repository":{"id":52105600,"uuid":"139286538","full_name":"freethenation/rabbit-qps-exchange","owner":"freethenation","description":"Creates and maintains a rabbit exchange which enforces a QPS across queues","archived":false,"fork":false,"pushed_at":"2023-03-02T01:44:49.000Z","size":405,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-24T19:52:38.016Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/freethenation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-30T23:11:56.000Z","updated_at":"2022-03-15T18:56:35.000Z","dependencies_parsed_at":"2024-12-19T06:40:25.607Z","dependency_job_id":"8f6892c3-552c-43b1-9c99-1feffb8947a7","html_url":"https://github.com/freethenation/rabbit-qps-exchange","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/freethenation/rabbit-qps-exchange","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freethenation%2Frabbit-qps-exchange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freethenation%2Frabbit-qps-exchange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freethenation%2Frabbit-qps-exchange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freethenation%2Frabbit-qps-exchange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freethenation","download_url":"https://codeload.github.com/freethenation/rabbit-qps-exchange/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freethenation%2Frabbit-qps-exchange/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29153144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T02:39:25.012Z","status":"ssl_error","status_checked_at":"2026-02-06T02:37:22.784Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-14T11:27:23.203Z","updated_at":"2026-02-06T06:02:46.157Z","avatar_url":"https://github.com/freethenation.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rabbit QPS Exchange [![CircleCI](https://circleci.com/gh/freethenation/rabbit-qps-exchange.svg?style=svg)](https://circleci.com/gh/freethenation/rabbit-qps-exchange)\n\n\nRabbit has no built in mechanism to limit the number of messages consumed per second. If a burst of messages are published, workers can quickly overload other internal or external services. This project is a simple node.js script which adds a way to limit consumption to rabbit.\n\nSome example use cases:\n\n* Limit calls to an external service which limits QPS (queries per second)\n* Rate limit individual users without having to manage a queue per user. *Rabbit QPS Exchange will manage these queues for you.*\n* Easier rate limiting for 3rd party APIs which are often rate limit on a per user basis.\n* Batch together messages for database performance or APIs which provide batch operations.\n* Easily add rate limiting to an existing project. Simply publish to a different exchange and add a few rabbit message headers.\n\n## Basic Usage\n\n1. Run `./rabbit_qps_shovel.js --management http://guest:guest@localhost:15672/ --connection RABBIT_CONNECTION_STRING start`\n2. Publish your message to the `qps_exchange` with `qps-key` and `qps-delay` rabbit message headers\n3. A queue is automatically created for the provided `qps-key` to serialize messages and respect `qps-delay`\n4. Messages are routed to the [default exchange using their routing key](https://www.rabbitmq.com/tutorials/tutorial-four-javascript.html).\n5. Your worker handles the message\n\n## Installing\n* The rabbit server version must be \u003e 3.5.0\n* The rabbit server must have the management plugin installed (its http interface is used)\n* Install a modern version of node (async support is required)\n* Run `npm install`\n\n## Reference\n\nUsage: `./rabbit_qps_shovel.js [OPTIONS] COMMAND`\n\ncommands:\n\n* `help`   show help\n* `init`   create exchange and required queues then exit\n* `clean`  clean up idle queues then exit\n* `start`  ensure exchange and required queues, clean idle queues, and then start processing messages\n\noptions:\n\n* `--management` Rabbit management connection string. Example http://guest:guest@localhost:15672/ (REQUIRED)\n* `--connection` Rabbit connection string. See https://www.rabbitmq.com/uri-spec.html (REQUIRED)\n\n### Configuration headers\n\n| Header              | Description                                                                                                                | Type      | Default         |\n|---------------------|----------------------------------------------------------------------------------------------------------------------------|-----------|-----------------|\n| qps-key             | Used to serialize all messages sent to the `qps_exchange`                                                                  | string    | (required)      |\n| qps-delay           | Delay (in milliseconds) to wait after routing the message to the default exchange. Use to approximate messages per second. | int/float | 1000 ms         |\n| qps-max-priority    | Can be set along with normal Rabbit priority headers to allow prioritization                                               | integer   | no priority     |\n| qps-durable         | If set, queues created and managed by rabbit qps exchange will be durable                                                  | boolean   | false           |\n| qps-batch-size      | If set, will group this many messages together into a batch, all of which will be sent as separate messages simultaneously | integer   | 1 (no batching) |\n| qps-batch-timeout   | Maximum time (in millisecond) to wait for a full batch                                                                     | int/float | 1000 ms         |\n| qps-batch-combine   | If set, will combine batch messages together into a single message separated with ASCII newlines (`\\n`, `0x0A`)            | boolean   | false           |\n| qps-delay-lock-key  | Can be set to share the delay lock between multiple QPS keys. Defaults to `qps-key` if not set. (leaving as default recommended) | string    | `qps-key`       |\n\n### Internal Queues\n\nRabbit QPS Exchange automatically creates and deletes queues as required and the diagram below exemplifies their organization\n![Rabbit QPS Exchange internal organization](https://raw.githubusercontent.com/thingless/rabbit-qps-exchange/master/internal_queue_diagram.jpg)\n\n## Running Tests\n* Run a rabbitmq server\n* The rabbit server must have the management plugin installed\n* Run tests with `npm test`\n* The environment variables `RABBIT_CONN_STRING` and `MANAGEMENT_CONN_STRING` can be used to provide connection information\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreethenation%2Frabbit-qps-exchange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreethenation%2Frabbit-qps-exchange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreethenation%2Frabbit-qps-exchange/lists"}