{"id":32173371,"url":"https://github.com/conduitframework/conduit_amqp","last_synced_at":"2025-10-21T18:53:28.121Z","repository":{"id":46054385,"uuid":"71727570","full_name":"conduitframework/conduit_amqp","owner":"conduitframework","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-12T16:16:17.000Z","size":124,"stargazers_count":8,"open_issues_count":10,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T01:29:51.866Z","etag":null,"topics":["amqp","conduit","elixir","message-queue","rabbitmq"],"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":"CHANGELOG.md","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":"2016-10-23T20:21:56.000Z","updated_at":"2023-09-05T12:36:34.000Z","dependencies_parsed_at":"2022-08-26T11:11:14.885Z","dependency_job_id":null,"html_url":"https://github.com/conduitframework/conduit_amqp","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/conduitframework/conduit_amqp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fconduit_amqp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fconduit_amqp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fconduit_amqp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fconduit_amqp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conduitframework","download_url":"https://codeload.github.com/conduitframework/conduit_amqp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conduitframework%2Fconduit_amqp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280317279,"owners_count":26309997,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"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":["amqp","conduit","elixir","message-queue","rabbitmq"],"created_at":"2025-10-21T18:53:25.545Z","updated_at":"2025-10-21T18:53:28.114Z","avatar_url":"https://github.com/conduitframework.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ConduitAMQP\n\nAn AMQP adapter for [Conduit](https://github.com/conduitframework/conduit).\n\n## Installation\n\nThis package can be installed as:\n\n  1. Add `conduit_amqp` to your list of dependencies in `mix.exs`:\n\n        ```elixir\n        def deps do\n          [{:conduit_amqp, \"~\u003e 0.6.3\"}]\n        end\n        ```\n\n  2. Ensure `conduit_amqp` is started before your application:\n\n      ```elixir\n      def application do\n        [applications: [:conduit_amqp]]\n      end\n      ```\n\n## Configuring the Adapter\n\n```elixir\n# config/config.exs\n\nconfig :my_app, MyApp.Broker,\n  adapter: ConduitAMQP,\n  url: \"amqp://my_app:secret@my-rabbit-host.com\"\n\n# Stop lager redirecting :error_logger messages\nconfig :lager, :error_logger_redirect, false\n\n# Stop lager removing Logger's :error_logger handler\nconfig :lager, :error_logger_whitelist, [Logger.ErrorHandler]\n```\n\nFor the full set of options, see [ConduitAQMP](https://hexdocs.pm/conduit_amqp/ConduitAMQP.html).\n\n## Configuring Exchanges\n\nYou can define exchanges with the `exchange` macro in the\n`configure` block of your Broker. The `exchange` macro accepts\nthe name of the exchange and options for the exchange.\n\n### Options\n\n  * `:type` - Either `:topic`, `:fanout`, `:direct`, or `:headers`. Defaults to `:topic`.\n  * `:durable` - If set, keeps the Exchange between restarts of the broker. Defaults to `false`.\n  * `:auto_delete` - If set, deletes the Exchange once all queues unbind from it. Defaults to `false`.\n  * `:passive` - If set, returns an error if the Exchange does not already exist. Defaults to `false`.\n  * `:internal` - If set, the exchange may not be used directly by publishers. Defaults to `false`.\n\nSee [exchange.declare](https://www.rabbitmq.com/amqp-0-9-1-reference.html#exchange.declare) for more details.\n\n### Example\n\n```elixir\ndefmodule MyApp.Broker do\n  use Conduit.Broker, otp_app: :my_app\n\n  configure do\n    exchange \"my.topic\", type: :topic, durable: true\n  end\nend\n```\n\n## Configuring Queues\n\nYou can define queues with the `queue` macro in the\n`configure` block of your Broker. The `queue` macro accepts\nthe name of the queue and options for the exchange.\n\n### Options\n\n  * `:durable` - If set, keeps the Queue between restarts of the broker. Defaults to `false`.\n  * `:auto_delete` - If set, deletes the Queue once all subscribers disconnect. Defaults to `false`.\n  * `:exclusive` - If set, only one subscriber can consume from the Queue. Defaults to `false`.\n  * `:passive` - If set, raises an error unless the queue already exists.  Defaults to `false`.\n  * `:from` - A list of routing keys to bind the queue to.\n  * `:exchange` - Name of the exchange used to bind the queue to the routing keys.\n\nSee [queue.declare](https://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare) for more details.\n\n### Example\n\n```elixir\ndefmodule MyApp.Broker do\n  use Conduit.Broker, otp_app: :my_app\n\n  configure do\n    queue \"my.queue\", from: [\"#.created.user\"], exchange: \"amq.topic\", durable: true\n  end\nend\n```\n\n## Configuring a Subscriber\n\nInside an `incoming` block for a broker, you can define subscriptions to queues. Conduit will route messages on those\nqueues to your subscribers.\n\n``` elixir\ndefmodule MyApp.Broker do\n  incoming MyApp do\n    subscribe :my_subscriber, MySubscriber, from: \"my.queue\"\n    subscribe :my_other_subscriber, MyOtherSubscriber,\n      from: \"my.other.queue\",\n      prefetch_size: 20\n  end\nend\n```\n\n### Options\n\n* `:from` - Accepts a string or function that resolves to the queue to consume from. Defaults to the name of the route if not specified.\n* `:prefetch_size` - Size of prefetch buffer in octets. Defaults to `0`, which means no specific limit. This can also be configured globally by passing this same option when configuring your Broker.\n* `:prefetch_count` - Number of messages to prefetch. Defaults to `0`, which means no specific limit. This can also be configured globally by passing this same option when configuring your Broker.\n* `:consumer_tag` - Specifies the identifier for the consumer. The consumer tag is local to a channel, so two clients can use the same consumer tags. If this field is empty the server will generate a unique tag.\n* `:no_local` - If the no-local field is set the server will not send messages to the connection that published them. Defaults to `false`.\n* `:no_ack` - If this field is set the server does not expect acknowledgements for messages. That is, when a message is delivered to the client the server assumes the delivery will succeed and immediately dequeues it. Defaults to `false`.\n* `:exclusive` - Request exclusive consumer access, meaning only this consumer can access the queue. Defaults to `false`.\n* `:nowait` - If set, the server will not respond to the method. The client should not wait for a reply method. If the server could not complete the method it will raise a channel or connection exception. Defaults to `false`.\n* `:arguments` - A set of arguments for the consume. Defaults to `[]`.\n\n__Note: It's highly recommended to set `:prefetch_size` or `:prefetch_count` to a non-zero value to limit the memory consumed when a queue is backed up.__\n\nSee [basic.qos](https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos) and [basic.consume](https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.consume) for more details on options.\n\n## Configuring a Publisher\n\nInside an `outgoing` block for a broker, you can define publications to exchanges. Conduit will deliver messages using the\noptions specified. You can override these options, by passing different options to your broker's `publish/3`.\n\n``` elixir\ndefmodule MyApp.Broker do\n  outgoing do\n    publish :destination_route,\n      to: \"my.routing_key\",\n      exchange: \"amq.topic\"\n    publish :other_destination_route,\n      to: \"my.other.routing_key\",\n      exchange: \"amq.topic\"\n  end\nend\n```\n\n### Options\n\n* `:to` - The routing key for the message. If the message already has its destination set, this option will be ignored.\n* `:exchange` - The exchange to publish to. This option is required.\n- `:publisher_confirms` - This configures [publisher confirms](https://www.rabbitmq.com/confirms.html#publisher-confirms). Should be one of `:no_confirmation` (the default), `:wait` (if it should just return an `:timeout` atom on failure) or `:die` (raises an exception on timeout).\n- `:publisher_confirms_timeout` - The timeout in milliseconds for the server acknowledgement. Should be `:infinity` for no timeout (the default) or an integer number of milliseconds.\n\nSee [basic.publish](https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish) for more details.\n\n### Example usage\n\n```elixir\n%Message{}\n|\u003e put_body(%{\"my\" =\u003e \"message\"})\n|\u003e Broker.publish(:destination_route)\n```\n\n## Architecture\n\n![ConduitAQMP architecture](https://hexdocs.pm/conduit_amqp/assets/architecture.png)\n\nWhen ConduitAMQP is used as an adapter for Conduit, it starts ConduitAMQP as a child supervisor. ConduitAMQP starts:\n\n  1. ConduitAQMP.ConnPool - Creates and supervises a pool of AMQP connections.\n  2. ConduitAMQP.PubSub - Creates and supervises ConduitAMQP.PubPool and ConduitAMQP.SubPool.\n  3. ConduitAMQP.Subscribers - A supervisor for subscribers that process messages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitframework%2Fconduit_amqp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconduitframework%2Fconduit_amqp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitframework%2Fconduit_amqp/lists"}