add logs for node
This commit is contained in:
parent
aa90517c12
commit
7efc654cfd
15
node.go
15
node.go
|
@ -1,6 +1,10 @@
|
||||||
package natsio
|
package natsio
|
||||||
|
|
||||||
import "github.com/nats-io/nats.go"
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/nats-io/nats.go"
|
||||||
|
)
|
||||||
|
|
||||||
// Node include all necessary things of a client
|
// Node include all necessary things of a client
|
||||||
type Node struct {
|
type Node struct {
|
||||||
|
@ -10,10 +14,15 @@ type Node struct {
|
||||||
|
|
||||||
func (n Node) ServerQueueSubscribe(subjectName string, h nats.MsgHandler) {
|
func (n Node) ServerQueueSubscribe(subjectName string, h nats.MsgHandler) {
|
||||||
queueName := GenerateQueueNameFromSubject(subjectName)
|
queueName := GenerateQueueNameFromSubject(subjectName)
|
||||||
_, _ = n.Sv.QueueSubscribe(subjectName, queueName, h)
|
if _, err := n.Sv.QueueSubscribe(subjectName, queueName, h); err != nil {
|
||||||
|
fmt.Printf("[natsio.Node.ServerQueueSubscribe] error: %s \n", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n Node) JetStreamQueueSubscribe(subjectName string, h nats.MsgHandler) {
|
func (n Node) JetStreamQueueSubscribe(subjectName string, h nats.MsgHandler) {
|
||||||
queueName := GenerateQueueNameFromSubject(subjectName)
|
queueName := GenerateQueueNameFromSubject(subjectName)
|
||||||
_ = n.Js.QueueSubscribe(subjectName, queueName, h)
|
if err := n.Js.QueueSubscribe(subjectName, queueName, h); err != nil {
|
||||||
|
fmt.Printf("[natsio.Node.ServerQueueSubscribe] error: %s \n", err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue