Queue Subscriptions
Last updated
Was this helpful?
Last updated
Was this helpful?
Subscribing to a is only slightly different than subscribing to a subject alone. The application simply includes a queue name with the subscription. The server will load balance between all members of the queue group. In a cluster setup, every member has the same chance of receiving a particular message.
Keep in mind that queue groups in NATS are dynamic and do not require any server configuration.
As an example, to subscribe to the queue workers
with the subject updates
:
If you run this example with the publish examples that send to updates
, you will see that one of the instances gets a message while the others you run won't. But the instance that receives the message will change.