From 239346a4357493fc471e6b7951627a9ca29edd76 Mon Sep 17 00:00:00 2001 From: namhq1989 Date: Fri, 16 Dec 2022 10:51:21 +0700 Subject: [PATCH] add method generate queue name from subject name --- utils.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils.go b/utils.go index e6930bf..2f49fb1 100644 --- a/utils.go +++ b/utils.go @@ -3,6 +3,7 @@ package natsio import ( "encoding/json" "fmt" + "strings" "github.com/thoas/go-funk" ) @@ -30,6 +31,10 @@ func GenerateReqrepSubject(stream, server, subject string) string { return fmt.Sprintf("%s.reqrep.%s.%s", stream, server, subject) } +func GenerateQueueNameFromSubject(subject string) string { + return strings.ReplaceAll(subject, ".", "_") +} + // InterfaceToBytes ... func InterfaceToBytes(data interface{}) []byte { b, err := json.Marshal(data)