24 lines
519 B
Go
24 lines
519 B
Go
|
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
|
||
|
}
|