{"id":18508060,"url":"https://github.com/imqueue/core","last_synced_at":"2025-06-14T08:09:48.551Z","repository":{"id":50781771,"uuid":"123814024","full_name":"imqueue/core","owner":"imqueue","description":"Simple JSON-based messaging queue for inter service communication","archived":false,"fork":false,"pushed_at":"2025-06-12T17:12:14.000Z","size":887,"stargazers_count":29,"open_issues_count":8,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-12T17:27:52.525Z","etag":null,"topics":["inter-service-communication","json","json-message","message-delivery","message-queue","redis","redis-queue","redis-server"],"latest_commit_sha":null,"homepage":"https://imqueue.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imqueue.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-04T17:56:48.000Z","updated_at":"2024-11-06T18:54:25.000Z","dependencies_parsed_at":"2024-01-15T18:08:50.816Z","dependency_job_id":"8f140679-f116-421d-9d4c-ff733d1f24f7","html_url":"https://github.com/imqueue/core","commit_stats":{"total_commits":281,"total_committers":2,"mean_commits":140.5,"dds":0.003558718861209953,"last_synced_commit":"2ed380d6d45504a5b3889400adf617ac47fa39eb"},"previous_names":["imqueue/imq"],"tags_count":95,"template":false,"template_full_name":null,"purl":"pkg:github/imqueue/core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imqueue","download_url":"https://codeload.github.com/imqueue/core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fcore/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259783069,"owners_count":22910301,"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":["inter-service-communication","json","json-message","message-delivery","message-queue","redis","redis-queue","redis-server"],"created_at":"2024-11-06T15:13:15.304Z","updated_at":"2025-06-14T08:09:48.530Z","avatar_url":"https://github.com/imqueue.png","language":"TypeScript","readme":"# I Message Queue (@imqueue/core)\n\n[![Build Status](https://travis-ci.org/imqueue/core.svg?branch=master)](https://travis-ci.org/imqueue/core) \n[![codebeat badge](https://codebeat.co/badges/b7685cb5-b290-47de-80e1-bde3e0582355)](https://codebeat.co/projects/github-com-imqueue-core-master)\n[![Coverage Status](https://coveralls.io/repos/github/imqueue/core/badge.svg?branch=master)](https://coveralls.io/github/imqueue/core?branch=master) \n[![Known Vulnerabilities](https://snyk.io/test/github/imqueue/core/badge.svg?targetFile=package.json)](https://snyk.io/test/github/imqueue/core?targetFile=package.json)\n[![License](https://img.shields.io/badge/license-ISC-blue.svg)](https://rawgit.com/imqueue/core/master/LICENSE)\n\nSimple JSON-based messaging queue for inter service communication\n\n**Related packages:**\n\n - [@imqueue/rpc](https://github.com/imqueue/rpc) - RPC-like client/service\n   implementation over @imqueue/core.\n - [@imqueue/cli](https://github.com/imqueue/cli) - Command Line Interface\n   for imqueue.\n\n# Features\n\nWith current implementation on RedisQueue:\n\n - **Fast unwarranted** message delivery (if consumer grab the message and dies \n   message will be lost). Up to ~35-40k of 1Kb messages per second on i7 core by\n   benchmarks.\n - **Fast warranted** message delivery (only 1.5-2 times slower than \n   unwarranted). If consumer grab a message and dies it will be re-scheduled\n   in queue. Up to ~20-25K of 1Kb messages per second on i7 core by benchmarks.\n - **No timers or constant redis polling** used for implementation, as result -\n   no delays in delivery and low CPU usage on application workers. When idling\n   it does not consume resources!\n - **Supports gzip compression for messages** (decrease traffic usage, but \n   slower).\n - **Concurrent workers model supported**, the same queue can have multiple\n   consumers.\n - **Delayed messages supported**, fast as ~10K of 1Kb messages per second on i7 \n   core by benchmarks.\n - **Safe predictable scaling of queues**. Scaling number of workers does not \n   influence traffic usage.\n - **Round-robin message balancing between several redis instances**. This\n   allows easy messaging queue redis horizontal scaling.\n - **TypeScript included!**\n\n# Requirements\n\nCurrently this module have only one available adapter which is Redis server\nrelated. So redis-server \u003e 3.8+ is required.\n\nIf config command is disabled on redis it will be required to turn on manually\nkeyspace notification events (actual on use with ElasticCache on AWS), like:\n\n~~~\nnotify-keyspace-events Ex\n~~~\n\nFurther, more adapters will be added... if needed.\n\n# Install\n\n~~~bash\nnpm i --save @imqueue/core\n~~~\n\n# Usage\n\n~~~typescript\nimport IMQ, { IMessageQueue, IJson } from '@imqueue/core';\n\n(async () =\u003e {\n    const queueOne: IMessageQueue = IMQ.create('QueueOne');\n    const queueTwo: IMessageQueue = IMQ.create('QueueTwo');\n\n    // start queues\n    await queueOne.start();\n    await queueTwo.start();\n\n    // handle queue messages\n    queueOne.on('message', (message: IJson, id: string, fromQueue: string) =\u003e {\n        console.log('queueOne message received:', message, id, fromQueue);\n\n        if (message.delay) {\n            queueOne.destroy();\n            queueTwo.destroy();\n        }\n    });\n    queueTwo.on('message', (message: IJson, id: string, fromQueue: string) =\u003e {\n        console.log('queueTwo message received:', message, id, fromQueue);\n    });\n\n    // sending queue messages\n    await queueOne.send('QueueTwo', { hello: 'two' });\n    await queueTwo.send('QueueOne', { hello: 'one' });\n\n    // sending delayed messages\n    const delay = 1000;\n    await queueOne.send('QueueOne', { delay }, delay);\n})();\n~~~\n\n# Benchmarking\n\nFirst of all make sure redis-server is running on the localhost. Current\nversion of benchmark supposed to have redis running localhost because\nit is going to measure it's CPU usage stats.\n\nAll workers during benchmark test will have their dedicated CPU affinity\nto make sure collected stats as accurate as possible.\n\n~~~bash\ngit clone git@github.com:Mikhus/core.git\ncd imq\nnode benchmark -c 4 -m 10000\n~~~\n\nOther possible benchmark options:\n\n~~~\nnode benchmark -h                                   \nOptions:\n  --version                     Show version number                    [boolean]\n  -h, --help                    Show help                              [boolean]\n  -c, --children                Number of children test process to fork\n  -d, --delay                   Number of milliseconds to delay message delivery\n                                for delayed messages. By default delayed\n                                messages is of and this argument is equal to 0.\n  -m, --messages                Number of messages to be sent by a child process\n                                during test execution.\n  -z, --gzip                    Use gzip for message encoding/decoding.[boolean]\n  -s, --safe                    Use safe (guaranteed) message delivery\n                                algorithm.                             [boolean]\n  -e, --example-message         Path to a file containing JSON of example\n                                message to use during the tests.\n  -p, --port                    Redis server port to connect to.\n  -t, --message-multiply-times  Increase sample message data given number of\n                                times.\n~~~\n\nNumber of child workers running message queues are limited to a max number\nof CPU in the system -2. First one, which is CPU0 is reserved for OS tasks and\nfor stats collector process. Second, which is CPU1 is dedicated to redis\nprocess running on a local machine, All others are safe to run queue workers.\n\nFor example, if there is 8 cores on a machine it is safe to run up to 6 workers.\nFor 4-core machine this number is limited to 2.\nIf there is less cores results will not give good visibility of load.\n\n*NOTE: paragraphs above this note are Linux-only related! On MacOS \nthere is no good way to set process affinity to a CPU core, Windows support is\nnot tested and is missing for the moment in benchmarking. I does not mean\nbenchmark will not work on Mac \u0026 Win but the results won't be accurate and\npredictable.*\n\n## Running Unit Tests\n\n~~~bash\ngit clone git@github.com:imqueue/core.git\ncd imq\nnpm test\n~~~\n\n## License\n\n[ISC](https://rawgit.com/imqueue/core/master/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimqueue%2Fcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimqueue%2Fcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimqueue%2Fcore/lists"}