-
Notifications
You must be signed in to change notification settings - Fork 279
Receive MessageCountDetails for a Subscription #1001
Description
Hello,
I'm interested in receiving the MessageCountDetails
from your API, as I see that it is possible to do by using the C# SDK)
Basically I'm trying to get the total count of dead letters per subscription.
AFAIU this should be possible: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dead-letter-queues#path-to-the-dead-letter-queue
Path to the dead-letter queue
You can access the dead-letter queue by using the following syntax:
/$deadletterqueue
/Subscriptions//$deadletterqueue
If you are using the .NET SDK, you can get the path to the dead-letter queue by using the SubscriptionClient.FormatDeadLetterPath() method. This method takes the topic name/subscription name and suffixes with /$DeadLetterQueue.
However, I could not figure how to get it using the PHP API.
Even when I manually edited the subscription path:
public function getSubscription($topicPath, $subscriptionName) {
$httpCallContext = new HttpCallContext();
$httpCallContext->setMethod(Resources::HTTP_GET);
$httpCallContext->addStatusCode(Resources::STATUS_OK);
$subscriptionPath = sprintf(
Resources::SUBSCRIPTION_PATH . '/$DeadLetterQueue/',
$topicPath,
$subscriptionName
);
$httpCallContext->setPath($subscriptionPath);
$response = $this->sendHttpContext($httpCallContext);
var_dump((string) $response->getBody());die;
$subscriptionInfo = new SubscriptionInfo();
$subscriptionInfo->parseXml($response->getBody());
return $subscriptionInfo;
}
I ended up with this message:
Bad Request\ndetails (if any):
400
The specified HTTP verb (GET) is not valid. To know more visit https://aka.ms/sbResourceMgrExceptions. . TrackingId:9a2587c8-a409-4bdf-bbee-37ae63107c81_G9, SystemTracker:stage-green-eye:Topic:main, Timestamp:2019-11-10T23:43:40.","file":"/private/var/projects/annotation-tool/vendor/microsoft/windowsazure/src/Common/Internal/Http/HttpClient.php","line":405,"0":"WindowsAzure\Common\Internal\Http\HttpClient:throwIfError:301\n","1":"WindowsAzure\Common\Internal\Http\HttpClient:sendAndGetHttpResponse:144\n","2":"WindowsAzure\Common\Internal\RestProxy:sendHttpContext:85\n","3":"WindowsAzure\Common\Internal\ServiceRestProxy:sendHttpContext:709\n","4":"WindowsAzure\ServiceBus\ServiceBusRestProxy:getSubscription:186\n
What can I do in order to get this information?
Thank you
Shaked