package amqp-client-lwt

  1. Overview
  2. Docs

Operations on channels

type _ t
type 'a confirms
type no_confirm = [
  1. | `Ok
]
type with_confirm = [
  1. | `Ok
  2. | `Failed
]
val no_confirm : no_confirm confirms
val with_confirm : with_confirm confirms
val create : id:string -> 'a confirms -> Framing.t -> Framing.channel_no -> 'a t Thread.Deferred.t

Create a new channel. Use Connection.open_channel rather than this method directly

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

Close the channel

val on_closed : _ t -> unit Thread.Deferred.t

on_closed becomes determined after then channel is closed.

If there are no consumers of this when the channel is close Connection_closed will be raised to the governing exception handler (the parent monitor in async, or Lwt.async_exception_hook in lwt).

Receive all returned messages. Reutnred message will be send to all readers returned from call to this function. Listening for returned messages are useful in e.g. rpc to know that message delivery failed and then stop waiting for a response.

Note that channels in ack mode there is no need to listen for returned messages, as message delivery will fail synchoniously.

val id : _ t -> string

Get the id of the channel

val channel_no : _ t -> int

Get the channel_no of the connection

val set_prefetch : ?count:int -> ?size:int -> _ t -> unit Thread.Deferred.t

Set prefetch counters for a channel.

  • parameter count

    Maximum messages inflight (un-acked)

  • parameter size

    Maximum amount of bytes inflight

    Note. if using rabbitmq, the prefetch limits are set per consumer on the channel, rather than per channel (across consumers)

val set_global_prefetch : ?count:int -> ?size:int -> _ t -> unit Thread.Deferred.t

Set global prefetch counters.

  • parameter count

    Maximum messages inflight (un-acked)

  • parameter size

    Maximum amount of bytes inflight

    Note: if using rabbitmq, the prefetch limits are set per channel (across consumers), If not, the global prefetch settings is applied globally - across consumers and channels.

val flush : _ t -> unit Thread.Deferred.t

Flush the channel, making sure all messages have been sent

module Transaction : sig ... end

Transactions. Transactions can be made per channel.

OCaml

Innovation. Community. Security.