natsio/node.go

20 lines
528 B
Go

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)
}