module Netamqp_connection:Manage AMQP connectionssig..end
There is another handshake at connection close time where one peer initiates the closure and the other peer has to approve. Either peer can initiate closure. It is possible to transmit error codes at connection close time.
The transport stream is automatically closed when the close handshake has finished.
In this implementation, connection management is separated from
endpoint management. The latter is done in Netamqp_endpoint,
and describes the AMQP client on a lower level.
exception Not_open
exception Error of string
type connection
type auth_method
typelocale_preference =[ `Pref of string | `Select of string list -> string ]
`Pref p: Prefer the locale p if possible, otherwise choose the
first locale offered by the server`Select f: Call the function f with all possibilities to select
the locale.val create : Netamqp_endpoint.endpoint -> connection`Off state. The returned connection object is
still closed, and may now be opened.val open_e : connection ->
auth_method list ->
locale_preference -> string -> unit Uq_engines.engine
The string argument is the virtual host of the AMQP server to
connect to, e.g. "/".
val open_s : connection ->
auth_method list ->
locale_preference -> string -> unitval close_e : connection -> unit Uq_engines.engineval close_s : connection -> unitval is_open : connection -> boolopen_e or open_s are done.
Note that the peer can close channels at
any time, so there is no guarantee that the channel is still open
when is_open returns true.
Checking is_open is mainly useful for recovery after exceptions.
Some exceptions close the channel, some do not.
val plain_auth : string -> string -> auth_methodplain_auth username password: use PLAIN authentication.
Note that username and password are not encrypted on the wire!
val endpoint : connection -> Netamqp_endpoint.endpointval event_system : connection -> Unixqueue.event_system