package amqp-client-async

  1. Overview
  2. Docs
type t

Connection

val connect : id:string -> ?virtual_host:string -> ?port:int -> ?credentials:(string * string) -> ?heartbeat:int -> string -> t Thread.Deferred.t

Connect to an Amqp server.

connect ~id:"test" localhost connects to localhost using default guest credentials, with identity "test"

  • parameter id

    an identifier of the connection used for tracing and debugging

  • parameter credentials

    a tuple of username * password. The credentials are transmitted in plain text

  • parameter virtual_host

    Named of the virtual host. Virtual must be defined on the amqp-server prior to connecting them. Default "/"

  • parameter port

    The port to connect to

  • parameter heartbeat

    Delay between heartbeats in seconds. Lower the number to detect connection loss faster.

    If an error occurs an exception is raised. To capture and handle exceptions it is advised to detach a monitor Core.Async.Monitor and handle raised exceptions.

    The most important exception is Connection_closed. As the connection is stateful (channels are tied to connections e.g), the connection cannot be re-established without redoing all initalization.

val open_channel : id:string -> 'a Channel.confirms -> t -> 'a Channel.t Thread.Deferred.t

Open a new channel.

  • parameter id

    identifies the channel for tracing and debugging

val close : t -> unit Thread.Deferred.t
OCaml

Innovation. Community. Security.