natsio/jetstream_queue.go

24 lines
519 B
Go
Raw Normal View History

2023-04-27 04:19:33 +00:00
package natsio
import (
"errors"
"fmt"
"github.com/nats-io/nats.go"
)
// QueueSubscribe ...
func (js JetStream) QueueSubscribe(subject, queueName string, cb nats.MsgHandler) error {
_, err := js.instance.QueueSubscribe(subject, queueName, cb)
if err != nil {
msg := fmt.Sprintf("[natsio.JetStream] queue subscribe with subject #%s error: %s", subject, err.Error())
return errors.New(msg)
}
if js.cfg.Debug {
fmt.Printf("[natsio.JetStream] queue subscribe to subject #%s \n", subject)
}
return nil
}