package amqp-client-async

Build not checked
  1. Overview
  2. Docs
Amqp client library, async version

Install

dune-project
 Dependency

Authors

Maintainers

Sources

2.0.3.tar.gz
sha256=80cac0c62d3d5079441502104f683990683561efc9c0e7b06f0d3388c79a3394
md5=4ff63b64da873a14047f541584c30d56

Description

Added to opam-repository:

README

OCaml client library for AMQP

Amqp-client is a AMQP client library written in pure OCaml. The library implements AMQP protocol version 0.9.1 as well as RabbitMQ-specific extensions. It supports both Core Async and Lwt threading models.

Amqp-client is tested extensively against RabbitMQ, but should work with any AMQP server.

The library exposes low level protocol handling though Amqp_spec and Amqp_framing modules as well as a high level interface though module Amqp.

The high level interface exposes usage patterns such as

  • create queue
  • consume from a queue
  • post message to a queue
  • create exchange
  • bind a queue to an exchange
  • post message to an exchange
  • RPC client / server

The library requires all resources to be explicitly allocated to avoid crashes because a service is relying on other services to allocate AMQP resources (exchanges, queues etc.).

Channels and consumers are tagged with an id, host name, pid etc. to ease tracing on AMQP level.

Documentation for the API.

Build infrastructure

The system is not functorized over an abstraction to the threading model. Instead the build system chooses which threading model abstraction to be used and stacially compiles it in. This has the advantage that files do not need to carry functor boilerplate

The disadvantage is that it does not allow users to supply their own threading model implementation.

Opam

It is recommended to install the package though opam. You should choose the package matching the concurrency library that your application will use

For Janestreet async: opam install amqp-client-async

For Ocsigen Lwt: opam install amqp-client-lwt

Manual build

To build the library

make build

make install will install both Lwt and Async versions.

Using the library

To compile using Async do:

ocamlfind ocamlopt -thread -package amqp-client-async myprog.ml

To compile using the Lwt version of the library do:

ocamlfind ocamlopt -thread -package amqp-client-lwt myprog.ml

Example (Async)

open Async
open Amqp_client_async

let host = "localhost"

let run () =
  Amqp.Connection.connect ~id:"MyConnection" host >>= fun connection ->
  Amqp.Connection.open_channel ~id:"MyChannel" Amqp.Channel.no_confirm connection >>= fun channel ->
  Amqp.Queue.declare channel "MyQueue" >>= fun queue ->
  Amqp.Queue.publish channel queue (Amqp.Message.make "My Message Payload") >>= function `Ok ->
  Amqp.Channel.close channel >>= fun () ->
  Amqp.Connection.close connection >>= fun () ->
  Shutdown.shutdown 0; return ()

let _ =
  don't_wait_for (run ());
  Scheduler.go ()

Compile with:

$ ocamlfind ocamlopt -thread -package amqp-client-async amqp_example.ml -linkpkg -o amqp_example

More examples are available here: https://github.com/andersfugmann/amqp-client/tree/master/examples

Dependencies (6)

  1. async >= "v0.10.0" & < "v0.16.0"
  2. ocplib-endian >= "0.6"
  3. amqp-client = "2.0.3"
  4. xml-light build
  5. dune
  6. ocaml >= "4.04.0"

Dev Dependencies

None

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building amqp-client-async with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
2.3.0 n/a good good good good
2.2.2 good good n/a n/a n/a
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure