2021-12-02 03:29:52 +00:00
|
|
|
package natsio
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/nats-io/nats.go"
|
|
|
|
)
|
|
|
|
|
|
|
|
// QueueSubscribe ...
|
|
|
|
func (js JetStream) QueueSubscribe(stream, subject, queueName string, cb nats.MsgHandler) error {
|
|
|
|
channel := combineStreamAndSubjectName(stream, subject)
|
|
|
|
|
|
|
|
_, err := js.instance.QueueSubscribe(channel, queueName, cb)
|
|
|
|
if err != nil {
|
2022-03-18 04:28:49 +00:00
|
|
|
msg := fmt.Sprintf("[NATS JETSTREAM] - queue subscribe with subject #%s error: %s", channel, err.Error())
|
2021-12-02 03:29:52 +00:00
|
|
|
return errors.New(msg)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|