[QUESTION] - How to restrict consuming previously consumed messages? #1502
-
I'm trying to learn and implement message broker in my app using nats.io and jetstream but got some weird issue. The repo I'm trying with: https://github.com/oarkflow/nats-app To start server: In a test, I published some messages using Please suggest any solution to the problem. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Consumer is a server side construct, so it definately can track the progress your app is making, no matter if you restart it or not. You need to create the Consumer first, then start fetching messagess. That is a much easier way to get what is happening. Here is a good example with the new API: Also check out the video we recently released about this topic: https://youtu.be/_CN1OO7yN0I?si=R3OjCc2Qw1tcAoho |
Beta Was this translation helpful? Give feedback.
Yes, because you create a new consumer every single time you call that method.
Here is a full example with the new JetStream API.