add node
This commit is contained in:
parent
2f57766b03
commit
415039292b
|
@ -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)
|
||||||
|
}
|
Loading…
Reference in New Issue