{"id":16701377,"url":"https://github.com/deadtrickster/amqp_rpc","last_synced_at":"2025-04-10T04:11:13.964Z","repository":{"id":57478872,"uuid":"64518024","full_name":"deadtrickster/amqp_rpc","owner":"deadtrickster","description":"RPC Client/Server for amqp Elixir library","archived":false,"fork":false,"pushed_at":"2019-09-25T12:17:50.000Z","size":22,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T05:26:59.334Z","etag":null,"topics":["amqp-rpc","elixir","fuse","monitoring","rabbitmq","rpc-client"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/deadtrickster.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}},"created_at":"2016-07-30T00:33:02.000Z","updated_at":"2023-09-06T17:38:00.000Z","dependencies_parsed_at":"2022-08-30T09:52:16.264Z","dependency_job_id":null,"html_url":"https://github.com/deadtrickster/amqp_rpc","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/deadtrickster%2Famqp_rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadtrickster%2Famqp_rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadtrickster%2Famqp_rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadtrickster%2Famqp_rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deadtrickster","download_url":"https://codeload.github.com/deadtrickster/amqp_rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154990,"owners_count":21056543,"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":["amqp-rpc","elixir","fuse","monitoring","rabbitmq","rpc-client"],"created_at":"2024-10-12T18:43:49.873Z","updated_at":"2025-04-10T04:11:13.936Z","avatar_url":"https://github.com/deadtrickster.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AMQP RPC Client/Server templates [![Build Status](https://travis-ci.org/deadtrickster/amqp_rpc.svg?branch=master)](https://travis-ci.org/deadtrickster/amqp_rpc) [![Hex.pm](https://img.shields.io/hexpm/v/amqp_rpc.svg?maxAge=2592000?style=plastic)](https://hex.pm/packages/amqp_rpc) \n\n**Warning!** POC quality!\n\n## Goals\n - Reduce boilerplate\n - Handle reconnects\n - Messages housekeeping \n - Logging\n - Monitoring\n - Use [fuse](https://github.com/jlouis/fuse)\n - Content negotiation\n\n### Fuse\n[Fuse](https://github.com/jlouis/fuse) helps reduce latency when something goes wrong with RabbitMQ or RPC server side by breaking circuit and returning immideately. Fuse can be configured via `fuse_name` and `fuse_opts` keys. We trying to maintain sensible default for those. \n\n### Monitoring/Instrumenting\nClients can be instrumented using built-in metrics plugins. Currenly [implemented](https://github.com/deadtrickster/amqp_rpc/blob/master/lib/amqp/rpc/stat/plugin.ex)\n - ETS-backed plugin (default)\n - [Prometheus](https://github.com/deadtrickster/prometheus.erl) plugin.\n\n## Example\n\nBelow is 'classic' RPC example from [RabbitMQ tutorials](http://www.rabbitmq.com/tutorials/tutorial-six-elixir.html)\nrewritten using amqp_rpc:\n\nClient:\n\n```elixir\ndefmodule Fibonacci do\n  use AMQP.RPC.Client, [exchange: \"\",\n                        queue: \"rpc_queue\"]\n\n  def fib(n, timeout \\\\ @timeout) do\n    rpc(%{command_name: \"fib\",\n          args: n}, timeout)\n  end\nend\n```\n\nServer:\n\n```elixir\ndefmodule FibonacciServer do\n  use AMQP.RPC.Server, [exchange: \"\",\n                        queue: \"rpc_queue\",\n                        commands: [:fib]]\n\n  ## adapted from https://gist.github.com/stevedowney/2f910bd3d72678b4cf99\n\n  def fib(0), do: 0\n\n  def fib(n)\n  when is_number(n) and n \u003e 0,\n    do: fib(n, 1, 0, 1)\n\n  def fib(_), do: [error: \"positive integers only\"]\n\n  def fib(n, m, _prev_fib, current_fib)\n  when n == m,\n    do: current_fib\n\n  def fib(n, m, prev_fib, current_fib),\n    do: fib(n, m+1, current_fib, prev_fib + current_fib)\n\nend\n```\n\n## Installation\n\n[Available in Hex](https://hex.pm/packages/amqp_rpc), the package can be installed as:\n\n  1. Add `amqp_rpc` to your list of dependencies in `mix.exs`:\n\n    ```elixir\n    def deps do\n      [{:amqp_rpc, \"~\u003e 0.0.7\"}]\n    end\n    ```\n\n  2. Ensure `amqp_rpc` is started before your application:\n\n    ```elixir\n    def application do\n      [applications: [:amqp_rpc]]\n    end\n    ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadtrickster%2Famqp_rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeadtrickster%2Famqp_rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadtrickster%2Famqp_rpc/lists"}