Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUERY] Determine length (count of messages) in subscription #18546

Closed
2 tasks done
lordarcy opened this issue Jan 11, 2021 · 3 comments
Closed
2 tasks done

[QUERY] Determine length (count of messages) in subscription #18546

lordarcy opened this issue Jan 11, 2021 · 3 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus

Comments

@lordarcy
Copy link

Query/Question
I have a program that is polling a subscription using a message receiver and the receive method to request new messages. Is there a way to monitor the length of the subscription so that a separate application can monitor the message count and see if everything is working.

Why is this not a Bug or a feature Request?
I don't know if the function already exists so I'm not making a feature request yet.

Setup (please complete the following information if applicable):

  • OS: RHEL 8.x
  • IDE : IntelliJ
  • 3.5.1

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Query Added
  • Setup information Added
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 11, 2021
@joshfree joshfree added Client This issue points to a problem in the data-plane of the library. Service Bus labels Jan 12, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 12, 2021
@joshfree
Copy link
Member

@hemanttanwar could you please follow up?

@hemanttanwar
Copy link
Contributor

hemanttanwar commented Jan 12, 2021

@lordarcy Thank you for trying our library. Appreciate it.

You are using library 3.5.1 and you should be able to use ManagementClient.getSubscriptionRuntimeInfo() .

https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.servicebus.management?view=azure-java-stable

https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.servicebus.management.subscriptionruntimeinfo.getmessagecount?view=azure-java-stable#com_microsoft_azure_servicebus_management_SubscriptionRuntimeInfo_getMessageCount__

We also have new library v7.0.0 and if you upgrade to this , @ https://search.maven.org/artifact/com.azure/azure-messaging-servicebus
You can use ServiceBusAdministrationClient to get count of messages.

        // Create a administrator client using connection string.
        ServiceBusAdministrationClient client = new ServiceBusAdministrationClientBuilder()
            .connectionString(connectionString)
            .buildClient();

        SubscriptionRuntimeProperties properties = client.getSubscriptionRuntimeProperties("topicName", "subscriptionName");        
        System.out.printf("Total message count: [%d].%n", properties.getTotalMessageCount()));

ServiceBusAdministrationClient : This is normally used CRUD operation on the resources like subscriber/queue.
If you need additional information , please let us know.

@hemanttanwar
Copy link
Contributor

@lordarcy Closing this issue. If you have further question, you can reopen this or a new issue.

@ramya-rao-a ramya-rao-a added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Feb 22, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus
Projects
None yet
Development

No branches or pull requests

4 participants