This sdk provides a convenient way to interact with the Azure Service Bus.
- Node.js version: 6.x or higher.
- We would still encourage you to install the latest available LTS version at any given time from https://nodejs.org. It is a good practice to always install the latest available LTS version of node.js.
- Installing node.js on Windows or macOS is very simple with available installers on the node.js website. If you are using a linux based OS, then you can find easy to follow, one step installation instructions over here.
npm install @azure/service-bus
This sdk has been developed in TypeScript and has good source code documentation. It is highly recommended to use vscode or any other IDE that provides better intellisense and exposes the full power of source code documentation.
You can set the following environment variable to get the debug logs.
- Getting debug logs from the Service Bus SDK
export DEBUG=azure*
- Getting debug logs from the Service Bus SDK and the protocol level library.
export DEBUG=azure*,rhea*
- If you are not interested in viewing the message transformation (which consumes lot of console/disk space) then you can set the
DEBUG
environment variable as follows:
export DEBUG=azure*,rhea*,-rhea:raw,-rhea:message,-azure:amqp-common:datatransformer
- If you are interested only in errors, then you can set the
DEBUG
environment variable as follows:
export DEBUG=azure:service-bus:error,azure-amqp-common:error,rhea-promise:error,rhea:events,rhea:frames,rhea:io,rhea:flow
- Set the
DEBUG
environment variable as shown above and then run your test script as follows:- Logging statements from you test script go to
out.log
and logging statement from the sdk go todebug.log
.node your-test-script.js > out.log 2>debug.log
- Logging statements from your test script and the sdk go to the same file
out.log
by redirecting stderr to stdout (&1), and then redirect stdout to a file:node your-test-script.js >out.log 2>&1
- Logging statements from your test script and the sdk go to the same file
out.log
.node your-test-script.js &> out.log
- Logging statements from you test script go to
Please take a look at the examples directory for detailed examples.
- Clone the repo and cd to the repo directory
git clone https://github.com/azure/azure-service-bus-node.git
cd azure-service-bus-node
- Install typescript, ts-node globally (optional, but very useful)
npm i -g typescript
npm i -g ts-node
- NPM install from the root of the package
npm i
- Build the project
npm run build
It depends on rhea-promise library for managing connections, sending and receiving messages over the AMQP protocol.