Closed dx3mod closed 3 weeks ago
After this discussion #8 it was decided to use Lwt_stream to handle the stream of incoming messages. Users subscribe to a subject and get a stream of messages (Message.Incoming.msg Lwt_stream.t) for that subject.
Lwt_stream
Message.Incoming.msg Lwt_stream.t
It allows users to use streams in many cases.
let%lwt foo_subj = client#sub ~subject:"FOO" () in Nats_client.Subscription.handle foo_subj (fun _ -> Lwt_io.printl "GOT MESSAGE FROM FOO SUBJECT"); (* ... *)
After this discussion #8 it was decided to use
Lwt_stream
to handle the stream of incoming messages. Users subscribe to a subject and get a stream of messages (Message.Incoming.msg Lwt_stream.t
) for that subject.It allows users to use streams in many cases.
Callback-like example
References