This commit is contained in:
namhq1989 2022-12-28 22:11:56 +07:00
parent 2f57766b03
commit 415039292b
1 changed files with 19 additions and 0 deletions

19
node.go Normal file
View File

@ -0,0 +1,19 @@
package natsio
import "github.com/nats-io/nats.go"
// Node include all necessary things of a client
type Node struct {
Sv Server
Js JetStream
}
func (n Node) ServerQueueSubscribe(subjectName string, h nats.MsgHandler) {
queueName := GenerateQueueNameFromSubject(subjectName)
_, _ = n.Sv.QueueSubscribe(subjectName, queueName, h)
}
func (n Node) JetStreamQueueSubscribe(subjectName string, h nats.MsgHandler) {
queueName := GenerateQueueNameFromSubject(subjectName)
_ = n.Js.QueueSubscribe(subjectName, queueName, h)
}