Multiple instances of the same durable pull based consumer (same consumer name) #1223
-
How do I go about setting up a durable pull consumer that could potentially auto scale up inside a Kubernetes cluster (multiple replica pods). What happens if there are multiple durable consumers with the same consumer name? The assumption is that there is only a single NATS server. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is nothing special to do to scale consumption of messages from a consumer because JS (unlike other streaming systems) is partition-less. Just start as many instances of your application (worker pods)as you need, and all of them can subscribe to the same durable consumer and the messages will be automatically distributed between them. You can add/remove subscribers (worked pods) at any time, there is literally nothing to do. |
Beta Was this translation helpful? Give feedback.
There is nothing special to do to scale consumption of messages from a consumer because JS (unlike other streaming systems) is partition-less. Just start as many instances of your application (worker pods)as you need, and all of them can subscribe to the same durable consumer and the messages will be automatically distributed between them. You can add/remove subscribers (worked pods) at any time, there is literally nothing to do.
And this works regardless of the number of servers in the cluster.