question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Service Bus] getSubscriptionRuntimeProperties does not give correct message counts

See original GitHub issue
  • Package Name: @azure/service-bus
  • Package Version: 7.0.2
  • nodejs
    • version: v12.10.0
  • typescript
    • version: 4.0.5

Describe the bug Method getSubscriptionRuntimeProperties of class ServiceBusAdministrationClient does not give correct message counts in properties.

More precisely, the internal method getMessageCountDetails parses the ServiceBus response expecting count properties to have prefix d2p1: while it is receiving those properties with prefix d3p1: withing response.parsedBody.CountDetails.

To Reproduce Steps to reproduce the behavior:

  1. Create ServiceBus topic
  2. Create subscription on this topic
  3. Send 3 messages on this to topic.
  4. Start node program using package with something like:
const client = new ServiceBusAdministrationClient(...);
const properties = await client.getSubscriptionRuntimeProperties('topic-name', 'sub-name');
console.log(properties.activeMessageCount); // prints "0"

Expected behavior

...
console.log(properties.activeMessageCount); // should print "3"

Additional context Note that response.parsedBody.CountDetails within the package code has the following value when I call getSubscriptionRuntimeProperties:

{
  $: {
    "xmlns:d3p1": "http://schemas.microsoft.com/netservices/2011/06/servicebus",
  },
  "d3p1:ActiveMessageCount": "3",
  "d3p1:DeadLetterMessageCount": "0",
  "d3p1:ScheduledMessageCount": "0",
  "d3p1:TransferMessageCount": "0",
  "d3p1:TransferDeadLetterMessageCount": "0",
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
HarshaNallurucommented, Jan 20, 2021

@laudibert The fix has been checked in, it would be included in the 7.0.3 version, which we aim to release by the end of this week.

If you’d like to try out the dev version of the package which includes the fix, please install with npm install @azure/service-bus@dev (New dev versions are released once a day.)

Current dev version - https://www.npmjs.com/package/@azure/service-bus/v/7.0.3-alpha.20210119.2

Feel free to open new issues in this repository in case you run into problems.

1reaction
HarshaNallurucommented, Jan 19, 2021

Hey @laudibert, thanks for waiting. I’ll try my best to get it reviewed and merged tomorrow and share a dev version with you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ServiceBusAdministrationClient class - Microsoft Learn
Returns an object representing the Subscription and its properties. If you want to get the Subscription runtime info like message count details, use ......
Read more >
Getting count of total messages in a subscription client that is ...
I am looking for node.js code, many places on internet they have given in JAVA or c# but for count I cannot find...
Read more >
ServiceBusManagementClient | @azure/service-bus - NET
Returns an object representing the Subscription runtime info like message count details. throws. RestError with code UnauthorizedRequestError when given request ...
Read more >
Microsoft Azure Service Bus operation
When it reaches this maximum, or the Maximum Message Count, the operation stops returning messages. If you do not provide a value, the...
Read more >
Azure Service Bus and its Complete Overview | Serverless360
With exceptional ingress rates, it can take on many incoming messages storing those internally offering no queue semantics. While it might sound like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found