package amqp-client-async

  1. Overview
  2. Docs

Rpc Client pattern

type t
val init : id:string -> Connection.t -> t Thread.Deferred.t

Initialize a client with the id for tracing

val call : t -> ?correlation_id:string -> ttl:int -> routing_key:string -> headers:Amqp_client_lib.Types.header list -> _ Exchange.t -> (Spec.Basic.Content.t * string) -> Message.message option Thread.Deferred.t

Make an rpc call to the exchange using the routing key and headers.

  • parameter ttl

    is the message timeout.

    To call directly to a named queue, use call t Exchange.default ~routing_key:"name_of_the_queue" ~headers:[]

    correlation_id allows you to specify a correlation id. The id will be suffixed with an id to allow the caller to reuse correlation ids. This can be used for tracing by reusing correlation ids of incomming requests resulting in new calls. If no correlation is given the id of the client is used.

    The function allows the call to specify both a routing key and headers regardless of the type of exchange used, as exchanges may be chained in a way where both headers and routing keys are used.

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

Release resources

OCaml

Innovation. Community. Security.