fix pullsub channel name
This commit is contained in:
parent
240cc725e8
commit
52d1c4839f
|
@ -35,19 +35,19 @@ func (js JetStream) Subscribe(stream, subject string, cb nats.MsgHandler) (*nats
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// sub, err := natsio.PullSubscribe("A_STREAM", "A_OBJECT")
|
// js := natsio.GetJetStream()
|
||||||
|
//
|
||||||
|
// sub, err := js.PullSubscribe("A_SUBJECT", "A_DURABLE")
|
||||||
//
|
//
|
||||||
// for {
|
// for {
|
||||||
// messages, err := sub.Fetch(10)
|
// messages, err := sub.Fetch(10)
|
||||||
// // process each messages
|
// // process each messages
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
func (js JetStream) PullSubscribe(stream, subject string) (*nats.Subscription, error) {
|
func (js JetStream) PullSubscribe(subject, durable string) (*nats.Subscription, error) {
|
||||||
channel := combineStreamAndSubjectName(stream, subject)
|
sub, err := js.instance.PullSubscribe(subject, durable)
|
||||||
|
|
||||||
sub, err := js.instance.PullSubscribe(stream, subject)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg := fmt.Sprintf("[NATS JETSTREAM] - pull subscribe subject #%s error: %s", channel, err.Error())
|
msg := fmt.Sprintf("[NATS JETSTREAM] - pull subscribe subject #%s - durable #%s error: %s", subject, durable, err.Error())
|
||||||
return nil, errors.New(msg)
|
return nil, errors.New(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue