From f83159126665175c887df0a05bacc3c449233efa Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Fri, 18 Mar 2022 11:07:46 +0700 Subject: [PATCH] add check consumer --- jetstream_pubsub.go | 2 +- natsio.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/jetstream_pubsub.go b/jetstream_pubsub.go index 806ac7c..e71e6b3 100644 --- a/jetstream_pubsub.go +++ b/jetstream_pubsub.go @@ -55,7 +55,7 @@ func (js JetStream) PullSubscribe(stream, subject, durable, consumer string) (*n info, err := js.instance.AddConsumer(stream, &nats.ConsumerConfig{ Durable: durable, AckPolicy: nats.AckExplicitPolicy, - FilterSubject: channel, + FilterSubject: subject, }) if err == nil { fmt.Println("CONSUMER INFO", info) diff --git a/natsio.go b/natsio.go index 33bdbb2..23a3903 100644 --- a/natsio.go +++ b/natsio.go @@ -21,6 +21,9 @@ type JetStream struct { var ( natsServer Server natsJetStream JetStream + + // FIXME: delete this + jsPublic nats.JetStreamContext ) // Connect ... @@ -62,6 +65,9 @@ func Connect(cfg Config) error { } natsJetStream.instance = js + // FIXME: delete this + jsPublic = js + return nil } @@ -74,3 +80,8 @@ func GetServer() Server { func GetJetStream() JetStream { return natsJetStream } + +// GetJSPublic ... +func GetJSPublic() nats.JetStreamContext { + return jsPublic +}