package amqp-client-lwt

  1. Overview
  2. Docs

Rpc Server pattern

type 'a t
val queue_argument : Amqp_client_lib.Types.header

Recommended argument to add when declaring the rpc server queue. This will set the dead letter exchange to the header exchange to help clients to be notified if a request has timed out

val start : ?async:bool -> ?discard_redelivered:bool -> [< `Failed | `Ok ] as 'a Channel.t -> Queue.t -> (Message.message -> Message.message Thread.Deferred.t) -> 'a t Thread.Deferred.t

Start an rpc server producing replies for requests coming in on the given queue.

  • parameter async

    If true, multiple requests can be handled concurrently. If false, message are handled synchronously (default)

    It is recommended to create the queue with the header_exchange as dead letter exchange. This will allow messages to be routed back the the sender at timeout. E.g: Queue.declare ~arguments:[Rpc.queue_argument] "rpcservice"

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

Stop the server

OCaml

Innovation. Community. Security.