Load balancing JetStream consumers
See original GitHub issueHello, I am currently using JetStream and I want to know if it’s possible to load balance my consumer, similar to specifying a queue group name in normal NATS. Right now, I have 2 instances of my application running, and each time a producer publishes a message, both instances of my application receive it (both using the same push consumer with a durable name). What I am looking for is a behavior similar to queue groups, where only one of the two instances receives the message.
I was told that this is possible in the nats.go library by subscribing to the stream using js.QueueSubscribe
, however, I cannot seem to find this documented with nats.js. Can someone point me in the right direction? Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top Results From Across the Web
JetStream - NATS Docs
JetStream consumers are 'views' on a stream, they are subscribed to (or pulled) by client applications to receive copies of (or to consume...
Read more >Getting queues working in JetStream #510 - nats-io/nats.net
... to me is how can I register two consumers to listen on the same subject and ensure only one of them gets...
Read more >NATS JetStream - ThinkMicroservices.com
By default, JetStream consumers are ephemeral. ... The controller creates the JetStream stream, pre-loads the stream with sample messages, ...
Read more >Grokking NATS Consumers: Push-based queue groups
There are two problems queue groups solve. The first, which core NATS and JetStream supports, is the need for load balancing and scaling...
Read more >Building Distributed Event Streaming Systems In Go With ...
The Pull based consumers let JetStream pull the messages from consumer systems. Pull based consumer systems are like work queues.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@csombok I have released nats v2.0.8 which exposes the queue option.
We are facing the same limitation and for us the only viable options is using the push based subscriber with STAN. Are there any ETA for merging this PR: https://github.com/nats-io/nats.deno/pull/162? As an alternative workaround we can use patch-package to have the fix as a patch in node_modules as a temporary solution.