From 6664e4ef98ca8aa9b26111b54374772a1d5e06c2 Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Thu, 2 Dec 2021 10:08:44 +0700 Subject: [PATCH] add request method --- request.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 request.go diff --git a/request.go b/request.go new file mode 100644 index 0000000..99bd1ff --- /dev/null +++ b/request.go @@ -0,0 +1,15 @@ +package natsio + +import ( + "time" + + "github.com/nats-io/nats.go" +) + +// Default timeout 10s +const requestTimeout = 10 * time.Second + +// Request ... +func Request(subject string, payload []byte) (*nats.Msg, error) { + return natsClient.Request(subject, payload, requestTimeout) +}