{"id":21723124,"url":"https://github.com/m-sardari/rabbitmq","last_synced_at":"2025-09-07T01:37:57.768Z","repository":{"id":64140340,"uuid":"571599137","full_name":"M-Sardari/RabbitMQ","owner":"M-Sardari","description":"RabbitMQ is a messaging broker - an intermediary for messaging","archived":false,"fork":false,"pushed_at":"2022-12-27T19:51:47.000Z","size":123,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T22:05:02.720Z","etag":null,"topics":["rabbit","rabbitmq","rabbitmq-client","rabbitmq-consumer","rabbitmq-producer","rabbitmq-server"],"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/M-Sardari.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":"2022-11-28T13:33:33.000Z","updated_at":"2023-02-13T11:41:01.000Z","dependencies_parsed_at":"2023-01-15T00:00:42.271Z","dependency_job_id":null,"html_url":"https://github.com/M-Sardari/RabbitMQ","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Sardari%2FRabbitMQ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Sardari%2FRabbitMQ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Sardari%2FRabbitMQ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Sardari%2FRabbitMQ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/M-Sardari","download_url":"https://codeload.github.com/M-Sardari/RabbitMQ/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637771,"owners_count":21137538,"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":["rabbit","rabbitmq","rabbitmq-client","rabbitmq-consumer","rabbitmq-producer","rabbitmq-server"],"created_at":"2024-11-26T02:36:57.726Z","updated_at":"2025-04-12T22:05:03.393Z","avatar_url":"https://github.com/M-Sardari.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Description\n\nRabbitMQ is a messaging broker - an intermediary for messaging. It gives your applications a common platform to send and receive messages, and your messages a safe place to live until received.\n\nYou can to use gadin-rabbit package easily and setup it.\n\n## Usage\n\n### Step 1: Installation\n\n```sh\nnpm install gadin-rabbit\n```\n\nwait for the installation to finish.\n\n### Step 2: Module initialization\n\nYou've added below code in your root module:\n```ts\n@Module({\n    imports: [\n        RmqModule.register({\n            uri: 'amqp://guest:guest@localhost:5672',\n            name : \"services\",\n            wait : true ,\n            timeout : 20000,\n            type : 'topic',\n            prefetchCount : 10\n        }),    \n    ],\n    controllers: [AppController],\n    providers: [AppService],\n})\nexport class AppModule {\n}\n```\n\n### Notice\n    1. The name, wait, timeout, type and prefetchCount are optional.\n    2. Default value of type is topic.\n\n### Step 3: Use in Services\n\nYou've to add these decorators above the functions:\n\n#### Subscribe\nIf the return value of your function is void, then you have to use this method:\n\n```ts\n@Subscribe({\n    routingKey: 'user.add',\n    queue: 'user-add',\n})\naddUser(objUser:any) : void\n{\n    // add user...\n}\n```\n\n#### Rpc\nIf the return value of your function is not void, then you have to use this method:\n\n```ts\n@Rpc({\n    routingKey: 'user.get',\n    queue: 'user-get',\n})\ngetUser(id:number) : User\n{\n    // get user...\n}\n```\n\n\n### Notice\nYou've to inject RmqService in your service and use rabbit methods like below:\n```ts\n@Injectable()\nexport class AppService {\n    constructor(private broker: RmqService) {\n    }\n}\n```\n\nIf you want consume your messages should be use these decorators: \n\n#### publish\nIf you want to call void message, then you've to use this way:\n\n```ts\nawait this.broker.publish('user.add', payload);\n```\n\n\n#### request\nIf you want to call don't void message, then you've to use this way:\n\n```ts\nreturn await this.broker.request\u003cany\u003e({ routingKey, payload, timeout });\n```\n\n\n### Hint\n    Import RmqModule, RmqService, Rpc and Subscribe from the gadin-rabbit\n\n\n## Author\n[Mohammad Sardari](mailto:m.sardari@live.com)\n\n## License\n\n[MIT License](./LICENCE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-sardari%2Frabbitmq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-sardari%2Frabbitmq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-sardari%2Frabbitmq/lists"}