Skip to content

Commit 0bcfed2

Browse files
authored
Merge pull request MicrosoftDocs#77095 from ramya-rao-a/patch-3
Include API reference links in Quick Start for Service Bus Queues
2 parents cfe34f6 + 3f510a9 commit 0bcfed2

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

articles/service-bus-messaging/service-bus-nodejs-how-to-use-queues-new-package.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ms.author: aschhab
2222
> - [(Node.js | azure-sb)](service-bus-nodejs-how-to-use-queues.md)
2323
> - [(Node.js | @azure/service-bus)](service-bus-nodejs-how-to-use-queues-new-package.md)
2424
25-
In this tutorial, you learn how to create Node.js applications to send messages to and receive messages from a Service Bus queue using the new [@azure/service-bus](https://www.npmjs.com/package/@azure/service-bus) package. This package uses the faster [AMQP 1.0 protocol](service-bus-amqp-overview.md) whereas the older [azure-sb](https://www.npmjs.com/package/azure-sb) package used [Service Bus REST run-time APIs](/rest/api/servicebus/service-bus-runtime-rest). The samples are written in JavaScript.
25+
In this tutorial, you learn how to write a Nodejs program to send messages to and receive messages from a Service Bus queue using the new [@azure/service-bus](https://www.npmjs.com/package/@azure/service-bus) package. This package uses the faster [AMQP 1.0 protocol](service-bus-amqp-overview.md) whereas the older [azure-sb](https://www.npmjs.com/package/azure-sb) package used [Service Bus REST run-time APIs](/rest/api/servicebus/service-bus-runtime-rest). The samples are written in JavaScript.
2626

2727
## Prerequisites
2828
- An Azure subscription. To complete this tutorial, you need an Azure account. You can activate your [MSDN subscriber benefits](https://azure.microsoft.com/pricing/member-offers/credit-for-visual-studio-subscribers/?WT.mc_id=A85619ABF) or sign up for a [free account](https://azure.microsoft.com/free/?WT.mc_id=A85619ABF).
@@ -40,10 +40,10 @@ npm install @azure/service-bus
4040
```
4141

4242
## Send messages to a queue
43-
Interacting with a Service Bus queue starts with instantiating the `ServiceBusClient` class and using it to instantiate the `QueueClient` class. Once you have the queue client, you can create a sender and use either `send` or `sendBatch` method on it to send messages.
43+
Interacting with a Service Bus queue starts with instantiating the [ServiceBusClient](https://docs.microsoft.com/javascript/api/@azure/service-bus/servicebusclient) class and using it to instantiate the [QueueClient](https://docs.microsoft.com/javascript/api/%40azure/service-bus/queueclient) class. Once you have the queue client, you can create a sender and use either [send](https://docs.microsoft.com/javascript/api/%40azure/service-bus/sender#send-sendablemessageinfo-) or [sendBatch](https://docs.microsoft.com/javascript/api/@azure/service-bus/sender#sendbatch-sendablemessageinfo---) method on it to send messages.
4444

45-
1. Open your favorite editor, such as Visual Studio Code
46-
2. Create a file called `send.js` and paste the below code into it
45+
1. Open your favorite editor, such as [Visual Studio Code](https://code.visualstudio.com/)
46+
2. Create a file called `send.js` and paste the below code into it. This code will send 10 messages to your queue.
4747

4848
```javascript
4949
const { ServiceBusClient } = require("@azure/service-bus");
@@ -81,17 +81,19 @@ Interacting with a Service Bus queue starts with instantiating the `ServiceBusCl
8181
});
8282
```
8383
3. Enter the connection string and name of your queue in the above code.
84-
4. Then run the command `node send.js` in a command prompt to execute this file. This command will send 10 messages to your queue.
84+
4. Then run the command `node send.js` in a command prompt to execute this file.
8585

86-
The messages you send can have some standard properties like `label` and `messageId`. If you want to set any custom properties, use the `userProperties`, which is a json object that can hold key-value pairs of your custom data.
86+
Congratulations! You just sent messages to a Service Bus queue.
8787

88-
Service Bus queues support a maximum message size of 256 KB in the [Standard tier](service-bus-premium-messaging.md) and 1 MB in the [Premium tier](service-bus-premium-messaging.md). There's no limit on the number of messages held in a queue but there's a cap on the total size of the messages held by a queue. This queue size is defined at creation time, with an upper limit of 5 GB. For more information about quotas, see [Service Bus quotas](service-bus-quotas.md).
88+
Messages have some standard properties like `label` and `messageId` that you can set when sending. If you want to set any custom properties, use the `userProperties`, which is a json object that can hold key-value pairs of your custom data.
89+
90+
Service Bus queues support a maximum message size of 256 KB in the [Standard tier](service-bus-premium-messaging.md) and 1 MB in the [Premium tier](service-bus-premium-messaging.md). There's no limit on the number of messages held in a queue but there's a cap on the total size of the messages held by a queue. This queue size is defined at creation time, with an upper limit of 5 GB. For more information about quotas, see [Service Bus quotas](service-bus-quotas.md).
8991

9092
## Receive messages from a queue
91-
Interacting with a Service Bus queue starts with instantiating the `ServiceBusClient` class and using it to instantiate the `QueueClient` class. Once you have the queue client, you can create a receiver and use either `receiveMessages` or `registerMessageHandler` method on it to receive messages.
93+
Interacting with a Service Bus queue starts with instantiating the [ServiceBusClient](https://docs.microsoft.com/javascript/api/@azure/service-bus/servicebusclient) class and using it to instantiate the [QueueClient](https://docs.microsoft.com/javascript/api/%40azure/service-bus/queueclient) class. Once you have the queue client, you can create a receiver and use either [receiveMessages](https://docs.microsoft.com/javascript/api/%40azure/service-bus/receiver#receivemessages-number--undefined---number-) or [registerMessageHandler](https://docs.microsoft.com/javascript/api/%40azure/service-bus/receiver#registermessagehandler-onmessage--onerror--messagehandleroptions-) method on it to receive messages.
9294

93-
1. Open your favorite editor, such as Visual Studio Code
94-
2. Create a file called `recieve.js` and paste the below code into it
95+
1. Open your favorite editor, such as [Visual Studio Code](https://code.visualstudio.com/)
96+
2. Create a file called `recieve.js` and paste the below code into it. This code will attempt to receive 10 messages from your queue. The actual count you receive depends on the number of messages in the queue and network latency.
9597

9698
```javascript
9799
const { ServiceBusClient, ReceiveMode } = require("@azure/service-bus");
@@ -120,9 +122,11 @@ Interacting with a Service Bus queue starts with instantiating the `ServiceBusCl
120122
});
121123
```
122124
3. Enter the connection string and name of your queue in the above code.
123-
4. Then run the command `node receiveMessages.js` in a command prompt to execute this file. This command will try to receive a maximum of 10 messages from your queue. The actual count you receive may depend on the number of messages in the queue and network latency.
125+
4. Then run the command `node receiveMessages.js` in a command prompt to execute this file.
126+
127+
Congratulations! You just received messages from a Service Bus queue.
124128

125-
The `createReceiver` method takes in a `ReceiveMode` which is an enum with values [ReceiveAndDelete](message-transfers-locks-settlement.md#settling-receive-operations) and [PeekLock](message-transfers-locks-settlement.md#settling-receive-operations). Remember to [settle your messages](message-transfers-locks-settlement.md#settling-receive-operations) if you use the `PeekLock` mode by using any of `complete()`, `abandon()`, `defer()`, or `deadletter()` methods on the message.
129+
The [createReceiver](https://docs.microsoft.com/javascript/api/%40azure/service-bus/queueclient#createreceiver-receivemode-) method takes in a `ReceiveMode` which is an enum with values [ReceiveAndDelete](message-transfers-locks-settlement.md#settling-receive-operations) and [PeekLock](message-transfers-locks-settlement.md#settling-receive-operations). Remember to [settle your messages](message-transfers-locks-settlement.md#settling-receive-operations) if you use the `PeekLock` mode by using any of `complete()`, `abandon()`, `defer()`, or `deadletter()` methods on the message.
126130

127131
## Next steps
128132
To learn more, see the following resources.

0 commit comments

Comments
 (0)