1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

Update queues.md

This commit is contained in:
Ginger Collison 2019-10-04 10:37:29 -05:00 committed by GitHub
parent fd8da6db04
commit 6d86b2886e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,24 +4,10 @@ Subscribing to a queue group is only slightly different than subscribing to a su
Keep in mind that the queue groups in NATS are dynamic and do not require any server configuration. You can almost think of a regular subscription as a queue group of 1, but it is probably not worth thinking too much about that. Keep in mind that the queue groups in NATS are dynamic and do not require any server configuration. You can almost think of a regular subscription as a queue group of 1, but it is probably not worth thinking too much about that.
<div class="graphviz"><code data-viz="dot"> ![Queue](/assets/images/queue.svg)
digraph g {
rankdir=LR
publisher [shape=box, style="rounded", label="PUB updates"];
subject [shape=circle, label="nats-server"];
sub1 [shape=box, style="rounded", label="SUB updates workers"];
sub2 [shape=box, style="rounded", label="SUB updates workers"];
sub3 [shape=box, style="rounded", label="SUB updates workers"];
publisher -> subject [label="msgs 1,2,3"];
subject -> sub1 [label="msg 2"];
subject -> sub2 [label="msg 1"];
subject -> sub3 [label="msg 3"];
}
</code></div>
As an example, to subscribe to the queue `workers` with the subject `updates`: As an example, to subscribe to the queue `workers` with the subject `updates`:
!INCLUDE "../../_examples/subscribe_queue.html" !INCLUDE "../../_examples/subscribe_queue.html"
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. 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.