add method generate queue name from subject name
This commit is contained in:
parent
21a288d927
commit
239346a435
5
utils.go
5
utils.go
|
@ -3,6 +3,7 @@ package natsio
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/thoas/go-funk"
|
"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)
|
return fmt.Sprintf("%s.reqrep.%s.%s", stream, server, subject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GenerateQueueNameFromSubject(subject string) string {
|
||||||
|
return strings.ReplaceAll(subject, ".", "_")
|
||||||
|
}
|
||||||
|
|
||||||
// InterfaceToBytes ...
|
// InterfaceToBytes ...
|
||||||
func InterfaceToBytes(data interface{}) []byte {
|
func InterfaceToBytes(data interface{}) []byte {
|
||||||
b, err := json.Marshal(data)
|
b, err := json.Marshal(data)
|
||||||
|
|
Loading…
Reference in New Issue