From 52d1c4839f6ee0fdc892f81a243659898ab17657 Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Fri, 18 Mar 2022 10:27:40 +0700 Subject: [PATCH] fix pullsub channel name --- jetstream_pubsub.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jetstream_pubsub.go b/jetstream_pubsub.go index daad7cd..311854e 100644 --- a/jetstream_pubsub.go +++ b/jetstream_pubsub.go @@ -35,19 +35,19 @@ func (js JetStream) Subscribe(stream, subject string, cb nats.MsgHandler) (*nats // // Example: // -// sub, err := natsio.PullSubscribe("A_STREAM", "A_OBJECT") +// js := natsio.GetJetStream() +// +// sub, err := js.PullSubscribe("A_SUBJECT", "A_DURABLE") // // for { // messages, err := sub.Fetch(10) // // process each messages // } // -func (js JetStream) PullSubscribe(stream, subject string) (*nats.Subscription, error) { - channel := combineStreamAndSubjectName(stream, subject) - - sub, err := js.instance.PullSubscribe(stream, subject) +func (js JetStream) PullSubscribe(subject, durable string) (*nats.Subscription, error) { + sub, err := js.instance.PullSubscribe(subject, durable) 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) }