{"id":15470494,"url":"https://github.com/andersfugmann/amqp-client","last_synced_at":"2025-06-27T18:07:14.925Z","repository":{"id":1922045,"uuid":"42546335","full_name":"andersfugmann/amqp-client","owner":"andersfugmann","description":"OCaml Amqp client library for Async and Lwt. ","archived":false,"fork":false,"pushed_at":"2024-06-01T09:59:55.000Z","size":1241,"stargazers_count":62,"open_issues_count":0,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-02T08:44:44.256Z","etag":null,"topics":["amqp-client","async","library","lwt","ocaml","ocaml-library","rabbitmq"],"latest_commit_sha":null,"homepage":"https://andersfugmann.github.io/amqp-client/index.html","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andersfugmann.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog","contributing":null,"funding":null,"license":"license.txt","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":"2015-09-15T21:01:33.000Z","updated_at":"2025-02-01T10:37:17.000Z","dependencies_parsed_at":"2023-12-24T01:24:14.354Z","dependency_job_id":"b25546bf-d5bd-4db8-8d10-afcdb2967648","html_url":"https://github.com/andersfugmann/amqp-client","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/andersfugmann/amqp-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersfugmann%2Famqp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersfugmann%2Famqp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersfugmann%2Famqp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersfugmann%2Famqp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andersfugmann","download_url":"https://codeload.github.com/andersfugmann/amqp-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersfugmann%2Famqp-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262307508,"owners_count":23291080,"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-client","async","library","lwt","ocaml","ocaml-library","rabbitmq"],"created_at":"2024-10-02T02:05:06.337Z","updated_at":"2025-06-27T18:07:14.892Z","avatar_url":"https://github.com/andersfugmann.png","language":"OCaml","funding_links":[],"categories":["Messaging"],"sub_categories":[],"readme":"OCaml client library for AMQP\n=============================\n[![Main workflow](https://github.com/andersfugmann/amqp-client/actions/workflows/workflow.yml/badge.svg)](https://github.com/andersfugmann/amqp-client/actions/workflows/workflow.yml)\n\nAmqp-client is a AMQP client library written in pure OCaml. The\nlibrary implements AMQP protocol version 0.9.1 as well as RabbitMQ-specific\nextensions. It supports both Core Async and Lwt threading models.\n\nAmqp-client is tested extensively against RabbitMQ, but should work\nwith any AMQP server.\n\nThe library exposes low level protocol handling through ```Amqp_spec```\nand ```Amqp_framing``` modules as well as a high level interface\nthough module ```Amqp```.\n\nThe high level interface exposes usage patterns such as\n * create queue\n * consume from a queue\n * post message to a queue\n * create exchange\n * bind a queue to an exchange\n * post message to an exchange\n * RPC client / server\n\nThe library requires all resources to be explicitly allocated to avoid\ncrashes because a service is relying on other services to allocate\nAMQP resources (exchanges, queues etc.).\n\nChannels and consumers are tagged with an id, host name, pid etc. to\nease tracing on AMQP level.\n\nThe design philiosiphy of the library is *fail fast*, meaning that if\nany external state changes (e.g. connection closes unexpectibly, queu\nconsumption is cancelled) an exception is raised, and It is adviced to\nlet the process crash and restart initialization rather than going\nthrough the complex task of reparing the state.\n\n[Documentation for the API](http://andersfugmann.github.io/amqp-client/index.html).\n\n### Build infrastructure\n\nThe system is not functorized over an abstraction to the threading\nmodel. Instead the build system chooses which threading model\nabstraction to be used and stacially compiles it in.  This has the\nadvantage that files do not need to carry functor boilerplate\n\nThe disadvantage is that it does not allow users to supply their own\nthreading model implementation.\n\n#### Opam\nIt is recommended to install the package though opam.\nYou should choose the package matching the concurrency library that your application will use\n\nFor Janestreet async: `opam install amqp-client-async`\n\nFor Ocsigen Lwt: `opam install amqp-client-lwt`\n\n#### Manual build\n\nTo build the library\n\n```make build```\n\n```make install``` will install both Lwt and Async versions.\n\n### Using the library\n\nTo compile using Async do:\n\n```ocamlfind ocamlopt -thread -package amqp-client-async myprog.ml```\n\nTo compile using the Lwt version of the library do:\n\n```ocamlfind ocamlopt -thread -package amqp-client-lwt myprog.ml```\n\n### Examples\n\n#### Async\nInstall the async version of the library: `opam install amqp-client-async`\n\n```ocaml\nopen Async\nopen Amqp_client_async\n\nlet host = \"localhost\"\n\nlet run () =\n  Amqp.Connection.connect ~id:\"MyConnection\" host \u003e\u003e= fun connection -\u003e\n  Amqp.Connection.open_channel ~id:\"MyChannel\" Amqp.Channel.no_confirm connection \u003e\u003e= fun channel -\u003e\n  Amqp.Queue.declare channel \"MyQueue\" \u003e\u003e= fun queue -\u003e\n  Amqp.Queue.publish channel queue (Amqp.Message.make \"My Message Payload\") \u003e\u003e= function `Ok -\u003e\n  Amqp.Channel.close channel \u003e\u003e= fun () -\u003e\n  Amqp.Connection.close connection \u003e\u003e= fun () -\u003e\n  Shutdown.shutdown 0; return ()\n\nlet _ =\n  Thread_safe.block_on_async_exn run\n```\n\nCompile with:\n```\n$ ocamlfind ocamlopt -thread -package amqp-client-async amqp_example.ml -linkpkg -o amqp_example\n```\n\n#### Lwt\nInstall the lwt version of the library: `opam install amqp-client-lwt`\n\n```ocaml\nopen Lwt.Infix\nopen Amqp_client_lwt\n\nlet host = \"localhost\"\n\nlet run () =\n  Amqp.Connection.connect ~id:\"MyConnection\" host \u003e\u003e= fun connection -\u003e\n  Amqp.Connection.open_channel ~id:\"MyChannel\" Amqp.Channel.no_confirm connection \u003e\u003e= fun channel -\u003e\n  Amqp.Queue.declare channel \"MyQueue\" \u003e\u003e= fun queue -\u003e\n  Amqp.Queue.publish channel queue (Amqp.Message.make \"My Message Payload\") \u003e\u003e= function `Ok -\u003e\n  Amqp.Channel.close channel \u003e\u003e= fun () -\u003e\n  Amqp.Connection.close connection \u003e\u003e= fun () -\u003e\n  Lwt.return ()\n\nlet _ =\n  Lwt_main.run (run ())\n```\n\nCompile with:\n\n```\n$ ocamlfind ocamlopt -thread -package amqp-client-lwt amqp_example.ml -linkpkg -o amqp_example\n```\n\nMore examples are available here: https://github.com/andersfugmann/amqp-client/tree/master/examples\n\nTo compile the examples do: `make examples`, which will place the\nbinaries under `_build/default/examples/`.\n\nIt is recommended to use *dune* for building projects and not invoke\nocaml/ocamlfind from the command line explicitly.\n\nA simple dune file for a project with one file called: `example.ml` looks like this:\n\n```lisp\n(executable\n  (name example)\n  (libraies amqp-client-async)\n)\n```\nTo build do `dune build example.exe`. For more information on dune,\nsee https://dune.readthedocs.io/en/latest/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersfugmann%2Famqp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandersfugmann%2Famqp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersfugmann%2Famqp-client/lists"}