diff --git a/developing-with-nats/tutorials/pubsub.md b/developing-with-nats/tutorials/pubsub.md index 9bd6855..e1d8d9e 100644 --- a/developing-with-nats/tutorials/pubsub.md +++ b/developing-with-nats/tutorials/pubsub.md @@ -1,6 +1,6 @@ # Explore NATS Pub/Sub -NATS is a publish subscribe messaging system. Subscribers listening on a subject receive messages on that subject. If the subscriber is not actively listening on the subject, the message is not received. Subscribers can use the wildcard tokens such as `*` and `>` to match a single token or to match the tail of a subject. +NATS is a [publish subscribe](../../nats-concepts/pubsub.md) messaging system [based on subjects](../../nats-concepts/subjects.md). Subscribers listening on a subject receive messages published on that subject. If the subscriber is not actively listening on the subject, the message is not received. Subscribers can use the wildcard tokens such as `*` and `>` to match a single token or to match the tail of a subject. ![](../../.gitbook/assets/pubsubtut.svg) @@ -82,9 +82,9 @@ or ### 8. Verify message publication and receipt -You should see that the publisher sends the message: _Published \[msg.test\] : 'NATS MESSAGE'_ +You should see that the publisher sends the message and prints: _Published \[msg.test\] : 'NATS MESSAGE'_ -And that the subscriber receives the message: _\[\#1\] Received on \[msg.test\]: 'NATS MESSAGE'_ +And that the subscriber receives the message and prints: _\[\#1\] Received on \[msg.test\]: 'NATS MESSAGE'_ Note that if the receiver does not get the message, check that you are using the same subject name for the publisher and the subscriber. @@ -94,7 +94,7 @@ Note that if the receiver does not get the message, check that you are using the % go run nats-pub/main.go msg.test "NATS MESSAGE 2" ``` -You should see that the subscriber receive message 2. Note that the message count is incremented each time your subscribing client receives a message on that subject: +You should see that the subscriber receives message 2. Note that the message count is incremented each time your subscribing client receives a message on that subject: ### 10. Start another shell or command prompt session @@ -106,7 +106,7 @@ You will use this session to run a second NATS subscriber. % cd $GOPATH/src/github.com/nats-io/nats.go/examples ``` -### 12. Subscribe to the message +### 12. Start a second client subscriber program ```bash % go run nats-sub/main.go msg.test @@ -130,7 +130,7 @@ You will use this session to run a third NATS subscriber. % cd $GOPATH/src/github.com/nats-io/nats.go/examples ``` -### 16. Subscribe to a different message +### 16. Subscribe to a different subject ```bash % go run nats-sub/main.go msg.test.new @@ -140,7 +140,7 @@ All the but last subscriber receives the message. Why? Because that subscriber i ### 17. Update the last subscriber to use a wildcard -NATS supports the use of wildcard characters for message subscribers. You cannot publish a message using a wildcard subject. +NATS supports the use of wildcard characters for message subscribers only. You cannot publish a message using a wildcard subject. Change the last subscriber the listen on msg.\* and run it: diff --git a/developing-with-nats/tutorials/queues.md b/developing-with-nats/tutorials/queues.md index 6a3170b..391d4b0 100644 --- a/developing-with-nats/tutorials/queues.md +++ b/developing-with-nats/tutorials/queues.md @@ -1,10 +1,10 @@ # Explore NATS Queueing -NATS supports a form of load balancing using queue groups. Subscribers register a queue group name. A single subscriber in the group is randomly selected to receive the message. +NATS supports a form of load balancing using [queue groups](../../nats-concepts/queue.md). Subscribers register a queue group name. A single subscriber in the group is randomly selected to receive the message. ## Prerequisites -Go and the NATS server should be installed. +Go, node.js, ruby and the NATS server should be installed. ### 1. Start the NATS server @@ -20,7 +20,7 @@ git clone https://github.com/nats-io/nats.js.git git clone https://github.com/nats-io/nats.rb.git ``` -### 3. Run the Go client subscriber with queue group name +### 3. Run the Go client subscriber, providing a queue group name ```bash cd $GOPATH/src/github.com/nats-io/nats.go/examples @@ -58,9 +58,9 @@ go run nats-pub/main.go foo "Hello NATS!" ### 8. Verify message publication and receipt -You should see that the publisher sends the message: _Published \[foo\] : 'Hello NATS!'_ +You should see that the publisher the message and prints: _Published \[foo\] : 'Hello NATS!'_ -You should see that only one of the my-queue group subscribers receives the message. In addition, the Go client subscriber not in the my-queue group should also receive the message. +You should see that only one of the my-queue group subscribers receives the message and prints it. In addition, the Go client subscriber not in the my-queue group should also receive and print the message. ### 9. Publish another message diff --git a/developing-with-nats/tutorials/reqreply.md b/developing-with-nats/tutorials/reqreply.md index 4510f0e..6c387e0 100644 --- a/developing-with-nats/tutorials/reqreply.md +++ b/developing-with-nats/tutorials/reqreply.md @@ -1,6 +1,6 @@ # Explore NATS Request/Reply -NATS supports request/reply messaging. In this tutorial you explore how to exchange point-to-point messages using NATS. +NATS supports [request/reply](../../nats-concepts/reqreply.md) messaging. In this tutorial you explore how to exchange point-to-point messages using NATS. ## Prerequisites @@ -25,18 +25,19 @@ You will use these sessions to run the NATS request and reply clients. ### 4. In one terminal, run the reply client listener ```bash -% go run nats-rply/main.go foo "this is my response" +% go run nats-rply/main.go help.please "OK, I CAN HELP!!!" ``` -You should see the message `Receiver is listening`, and that the NATS receiver client is listening on the "help.please" subject. The reply client acts as a receiver, listening for message requests. In NATS, the receiver is a subscriber. +You should see the message: _Listening on \[help.please\]_ + +This means that the NATS receiver client is listening for requests messages on the "help.please" subject. In NATS, the receiver is a subscriber. ### 5. In the other terminal, run the request client ```bash -% go run nats-req/main.go foo "request payload" +% go run nats-req/main.go help.please "some message" ``` The NATS requestor client makes a request by sending the message "some message" on the “help.please” subject. The NATS receiver client receives the message, formulates the reply \("OK, I CAN HELP!!!"\), and sends it to the inbox of the requester. -