Skip to content

How to pull from a subject? #1079

Answered by wallyqs
AhmedAbouelkher asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, this is because when you are creating the consumer via AddConsumer it is being created without a FilterSubject so it would match all the messages, and then later js.PullSubscribe("sub", "new_consumer", nats.Bind("new", "new_consumer") the Bind will reuse the created consumer without having to use the sub for the lookup to find the consumer so it becomes ignored.
If you remove AddConsumer and then do js.PullSubscribe("sub", "new_consumer") without Bind, then the consumer would be auto created with sub as a filter subject to narrow down the messages.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AhmedAbouelkher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants