{"id":32168599,"url":"https://github.com/conduitframework/phoenix_pubsub_conduit_amqp","last_synced_at":"2026-07-10T23:32:12.117Z","repository":{"id":57532790,"uuid":"118474974","full_name":"conduitframework/phoenix_pubsub_conduit_amqp","owner":"conduitframework","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-23T21:08:39.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-12T01:06:55.706Z","etag":null,"topics":[],"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/conduitframework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-22T15:23:18.000Z","updated_at":"2018-01-22T15:23:32.000Z","dependencies_parsed_at":"2022-09-26T18:22:09.286Z","dependency_job_id":null,"html_url":"https://github.com/conduitframework/phoenix_pubsub_conduit_amqp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/conduitframework/phoenix_pubsub_conduit_amqp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fphoenix_pubsub_conduit_amqp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fphoenix_pubsub_conduit_amqp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fphoenix_pubsub_conduit_amqp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fphoenix_pubsub_conduit_amqp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conduitframework","download_url":"https://codeload.github.com/conduitframework/phoenix_pubsub_conduit_amqp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fphoenix_pubsub_conduit_amqp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35346644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-10T02:00:06.465Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-10-21T15:56:38.625Z","updated_at":"2026-07-10T23:32:12.079Z","avatar_url":"https://github.com/conduitframework.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PhoenixPubsubConduitAMQP\n\nA phoenix pubsub adapter that uses Conduit and ConduitAMQP.\n\nPhoenix PubSub handles distributing messages between nodes to regarding websockets. It is useful in\nthe scenario where a websocket connection is made to server A and later a web request or message is\nreceived on server B that needs to broadcast to the websocket on server A. The pubsub adapter is\nthen able to distribute that information to any server, which may have a relevant websocket\nconnection.\n\nThis adapter uses a [Conduit](https://github.com/conduitframework/conduit) broker and\n[ConduitAMQP](https://github.com/conduitframework/conduit) as the mechanism to distribute messages\nbetween servers.\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `phoenix_pubsub_conduit_amqp` to your list of dependencies in `mix.exs`:\n\n``` elixir\n# mix.exs\ndef deps do\n  [\n    {:phoenix_pubsub_conduit_amqp, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Configuration\n\n``` elixir\n# config.exs\nconfig :my_app, MyApp.Endpoint,\n  url: [host: \"localhost\"],\n  secret_key_base: \"i5mdMSK9FcLUMAyIqtyptYPQrWTdIZJJ8N8eSseqn/LrW3ynJcTexai990u9Ea/K\",\n  render_errors: [view: MyApp.ErrorView, accepts: ~w(json)],\n  pubsub: [\n    name: MyApp.PubSub,\n    adapter: Phoenix.PubSub.ConduitAMQP,\n    broker: MyApp.Broker]\n```\n\nThe adapter expects to be passed a conduit broker as an option.\n\n## Application Startup\n\nYour broker should be configured to start after your endpoint.\n\n``` elixir\n# my_app.ex or application.ex\ndef start(_type, _args) do\n  import Supervisor.Spec\n\n  children = [\n    supervisor(MyApp.Endpoint, []),\n    supervisor(MyApp.Broker, [])\n  ]\n\n  opts = [strategy: :one_for_one, name: MyApp.Supervisor]\n  Supervisor.start_link(children, opts)\nend\n```\n\n## Broker\n\nThe broker must have an outgoing publish called `phoenix_pubsub_broadcast` and must have a\nsubscription that uses `Phoenix.PubSub.ConduitAMQP.Subscriber`.\n\nAdditionally, the subscriber should be uniquely bound per server to the exchange that\n`phoenix_pubsub_broadcast` publishes to.\n\nA minimal example of a broker that will work is:\n\n``` elixir\ndefmodule MyApp.Broker do\n  use Conduit.Broker, otp_app: :my_app\n\n  configure do\n    # All messages published to this exchange will be published to every bound queue\n    exchange \"phoenix.pubsub\", type: :fanout\n\n    # Will create queue name based on hostname and bind it to the fanout exchange. If the\n    # server restarts, the queue will be removed and recreated, since the messages in the\n    # queue are for websocket connections that no longer exist.\n    queue \u0026Phoenix.PubSub.ConduitAMQP.queue_name/0,\n      exchange: \"phoenix.pubsub\",\n      auto_delete: false,\n      from: [\"#\"]\n  end\n\n  pipeline :phoenix_pubsub_incoming do\n    # plug Conduit.Plug.LogIncoming\n    # plug Conduit.Plug.AckException\n\n    # Turns erlang binary into data\n    plug Conduit.Plug.Parse\n  end\n\n  incoming Phoenix.PubSub.ConduitAMQP do\n    pipe_through [:phoenix_pubsub_incoming]\n\n    # Subscribe to messages published to the phoenix.pubsub exchange that are deposited in this\n    # server specific queue.\n    subscribe :phoenix_pubsub_receive, Subscriber,\n      from: \u0026Phoenix.PubSub.ConduitAMQP.queue_name/1\n  end\n\n  pipeline :phoenix_pubsub_outgoing do\n    # plug Conduit.Plug.LogOutgoing\n\n    # Turns data into erlang binary, other formats are lossy\n    plug Conduit.Plug.Format,\n      content_type: \"application/x-erlang-binary\",\n      compressed: 6\n  end\n\n  outgoing do\n    pipe_through [:phoenix_pubsub_outgoing]\n\n    # Publish to phoenix.pubsub exchange with phoenix.pubsub routing key\n    publish :phoenix_pubsub_broadcast,\n      exchange: \"phoenix.pubsub\",\n      to: \"phoenix.pubsub\"\n  end\nend\n```\n\nIn this example, server A would create a queue `server_A` based on it's hostname, that is bound to\nthe `fanout` exchange `phoenix.pubsub`. When a message is broadcast, due to some external event, it\nwill be published using `phoenix_pubsub_broadcast` and publish to the `phoenix.pubsub` exchange.\nThe exchange will then publish the message to every queue bound to it. For server A, that means\nit's `server_A` queue, where it is read and passed to the `Phoenix.PubSub.ConduitAMQP.Subscriber`.\nThe `Phoenix.PubSub.ConduitAMQP.Subscriber`, then passes it off to `Phoenix.PubSub` which handles\neverything within the server.\n\nSee [ConduitAMQP](https://github.com/conduitframework/conduit_amqp) and\n[Conduit](https://github.com/conduitframework/conduit) for more about configuring a broker.\n\n## Documentation\n\nDocumentation can found at\n[https://hexdocs.pm/phoenix_pubsub_conduit_amqp](https://hexdocs.pm/phoenix_pubsub_conduit_amqp).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitframework%2Fphoenix_pubsub_conduit_amqp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconduitframework%2Fphoenix_pubsub_conduit_amqp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitframework%2Fphoenix_pubsub_conduit_amqp/lists"}