Skip to content

Commit

Permalink
Add ppx_deriving to depends
Browse files Browse the repository at this point in the history
  • Loading branch information
dx3mod committed Nov 18, 2024
1 parent aec74b9 commit e057db7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
(>= 4.14))
dune
yojson
ppx_deriving
ppx_yojson_conv
(alcotest :with-test))
(tags (nats)))
Expand Down
2 changes: 1 addition & 1 deletion examples/natsbyexample/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(executables
(names publish_subscribe)
(names publish_subscribe request_reply)
(libraries nats-client-lwt lwt)
(preprocess
(pps lwt_ppx)))
19 changes: 19 additions & 0 deletions examples/natsbyexample/request_reply.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let main =
Lwt_switch.with_switch @@ fun switch ->
let%lwt client =
Nats_client_lwt.connect ~switch ~settings:[ `Echo ]
(Uri.of_string "nats://127.0.0.1:4222")
in

let%lwt requests = Nats_client_lwt.sub client ~subject:"greet.*" () in

Nats_client_lwt.Subscription.handle requests (fun request ->
match request.reply_to with
| None -> Lwt.return_unit
| Some reply ->
Printf.sprintf "hello, %s" request.subject
|> Nats_client_lwt.pub client ~subject:reply);

Lwt.return_unit

let () = Lwt_main.run main
1 change: 1 addition & 0 deletions nats-client.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ depends: [
"ocaml" {>= "4.14"}
"dune" {>= "3.16"}
"yojson"
"ppx_deriving"
"ppx_yojson_conv"
"alcotest" {with-test}
"odoc" {with-doc}
Expand Down

0 comments on commit e057db7

Please sign in to comment.