{"id":18608846,"url":"https://github.com/recruitee/mq_tools","last_synced_at":"2025-11-02T18:30:33.583Z","repository":{"id":90117886,"uuid":"109849697","full_name":"Recruitee/mq_tools","owner":"Recruitee","description":"Easily define RabbitMq rpc providers","archived":false,"fork":false,"pushed_at":"2020-05-15T13:40:08.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-12-27T01:11:06.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/Recruitee.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-07T14:54:20.000Z","updated_at":"2023-12-20T08:56:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"e14e55b4-09bd-41d2-a990-59966c22334a","html_url":"https://github.com/Recruitee/mq_tools","commit_stats":{"total_commits":24,"total_committers":6,"mean_commits":4.0,"dds":0.5833333333333333,"last_synced_commit":"fe4b8063cd609883a4841bd7949a9c238a59b140"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Recruitee%2Fmq_tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Recruitee%2Fmq_tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Recruitee%2Fmq_tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Recruitee%2Fmq_tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Recruitee","download_url":"https://codeload.github.com/Recruitee/mq_tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239399814,"owners_count":19632022,"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":[],"created_at":"2024-11-07T03:04:29.075Z","updated_at":"2025-02-18T02:44:41.192Z","avatar_url":"https://github.com/Recruitee.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MQTools\n\nEasily defined rabbitmq providers and client for \"rpc\" pattern - as described here: https://www.rabbitmq.com/tutorials/tutorial-six-elixir.html\n\nThis software is still in early beta version. Use at your own discretion.\n\n\n## MQTools.Provider\n\nLet's you define rabbitmq 'rpc endpoints'.\n\n* Add `mq_tools` to dependencies in mix.exs\n* Configure the module:\n\n```\nconfig :mq_tools, :mq_providers,\n  connection: [\n    host: \"localhost\",\n    port: 5672,\n    virtual_host: \"/\",\n    user: \"guest\",\n    password: \"guest\"\n  ]\n```\n\n* Write a module defining RPC handlers:\n\n```\ndefmodule MyRpcHandlers do\n  use MQTools.Provider\n\n  defrpc \"foo.bar\" do\n    %{\"something\" =\u003e something} -\u003e \"reply...\"\n    _ -\u003e \"handle other payload\"\n  end\nend\n```\n\nand add the module to the config:\n\n```\nconfig :mq_tools, :mq_providers,\n  rpc_providers: [MyRpcHandlers],\n```\n\n## MQTools.Client\n\nCall previously defined providers. The one defined above could be called like so:\n\n```\n\u003e MQTools.Client.call(\"foo.bar\", %{something: \"here\"})\n=\u003e \"reply...\"\n\u003e MQTools.Client.call(\"foo.bar\", %{different: \"request\"})\n=\u003e \"handle other payload\"\n```\n\nIn case you just want to publish a message and you are not interested in the reply you can do the following:\n\n```\n\u003e MQTools.Client.publish(\"foo.bar\", %{something: \"here\"})\n=\u003e :ok\n```\n\nThere is also optional client timeout param if you ever need it (default 10000ms):\n\n```\n\u003e MQTools.Client.call(\"foo.bar\", %{something: \"here\"}, 7500) # timeout in ms\n=\u003e \"slow reply...\"\n```\n\n## Optional message encoding configuration\n\nBy default the messages are transported using json. If you want to change that you can define your own message encoder/decoder module.\n\n```\ndefmodule MyOwnMsgPacker do\n  @behaviour MQTools.Packer\n\n  def pack(term) do\n    SuperPackLib.pack(term)\n  end\n\n  def unpack(string) do\n    SuperPackLib.unpack(string)\n  end\n\nend\n```\n\nand set it in the config as your packer module:\n\n```\nconfig :mq_provider,\n  packer: MyOwnMsgPacker\n````\n\n\n## Kudos\nOrignally written by https://github.com/nilclass\n\n## License\n\nMQTools is released under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecruitee%2Fmq_tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecruitee%2Fmq_tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecruitee%2Fmq_tools/lists"}