https://github.com/harshanalluru/service-bus-18506
https://github.com/harshanalluru/service-bus-18506
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/harshanalluru/service-bus-18506
- Owner: HarshaNalluru
- Created: 2021-11-03T23:56:20.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-20T21:52:51.000Z (over 3 years ago)
- Last Synced: 2025-04-04T12:30:49.548Z (6 months ago)
- Language: TypeScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## User issue [#18506](https://github.com/Azure/azure-sdk-for-js/issues/18506)
### Steps to run the sample that uses ServiceBusAdministrationClient
1. Clone this project
2. `npm install` in this folder to install all the dependencies
3. Create `.env` file and populate it with `SERVICEBUS_CONNECTION_STRING` and `QUEUE_NAME` in it as shown in `sample.env`
4. Install `ts-node` globally (to be able to run the typescript file directly)
> `npm install ts-node -g`
5. Running the sample with `ts-node adminClient.ts` in this folder should give you the following output.```sh
C:\\service-bus-18506>ts-node adminClient.tsCreated queue with name - sample-queue
(Current)max delivery count = 10
(Updated)max delivery count = 12
Number of messages in the queue = 0
Name of the namespace -
Queue sample-queue has been deleted```
The sample uses updateQueue method along with the createQueue and getQueue methods, they all work fine.
```ts
const getQueueResponse = await serviceBusAdministrationClient.getQueue(
queueName
);
console.log(
"(Current)max delivery count = ",
getQueueResponse.maxDeliveryCount
);getQueueResponse.maxDeliveryCount = 12;
const updateQueueResponse = await serviceBusAdministrationClient.updateQueue(
getQueueResponse
);
console.log(
"(Updated)max delivery count = ",
updateQueueResponse.maxDeliveryCount
);
```The response from the getQueue method is modified and passed as an argument to the updateQueue method.