From 7efc654cfde2e0b9a12c09535b080ce3cf190795 Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Wed, 4 Jan 2023 14:02:10 +0700 Subject: [PATCH] add logs for node --- node.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/node.go b/node.go index 4c6ec8b..48d2797 100644 --- a/node.go +++ b/node.go @@ -1,6 +1,10 @@ package natsio -import "github.com/nats-io/nats.go" +import ( + "fmt" + + "github.com/nats-io/nats.go" +) // Node include all necessary things of a client type Node struct { @@ -10,10 +14,15 @@ type Node struct { func (n Node) ServerQueueSubscribe(subjectName string, h nats.MsgHandler) { queueName := GenerateQueueNameFromSubject(subjectName) - _, _ = n.Sv.QueueSubscribe(subjectName, queueName, h) + if _, err := n.Sv.QueueSubscribe(subjectName, queueName, h); err != nil { + fmt.Printf("[natsio.Node.ServerQueueSubscribe] error: %s \n", err.Error()) + } + } func (n Node) JetStreamQueueSubscribe(subjectName string, h nats.MsgHandler) { queueName := GenerateQueueNameFromSubject(subjectName) - _ = n.Js.QueueSubscribe(subjectName, queueName, h) + if err := n.Js.QueueSubscribe(subjectName, queueName, h); err != nil { + fmt.Printf("[natsio.Node.ServerQueueSubscribe] error: %s \n", err.Error()) + } }