[FEATURE REQ] Peek scheduled messages.
See original GitHub issueLibrary name
Azure.Messaging.ServiceBus
Please describe the feature.
I’m not sure if this should be a bug instead. Feel free to change this as necessary.
In the previous iterations of the Azure Services Bus client libraries for .NET (WindowsAzure.ServiceBus and Microsoft.ServiceBus.Messaging) it was possible to peek scheduled messages with TopicClient.Peek()
and TopicClient.PeekAsync()
According to this previously closed issue:
Scheduled messages reside in the topic until the scheduled time, and users should peek into the topic if they want to see the scheduled messages. Scheduled Messages can not be peeked from a subscription since they are not present in the subscription.
(strangely, the information added to the docs in this issue, seems to be gone again)
However in Azure.Messaging.ServiceBus, there is no equivalent to TopicClient
, Instances of ServiceBusReceiver
are always configured to a subscription on a topic, and never directly to the topic. Thus there is no way to peek scheduled messages, using Azure.Messaging.ServiceBus, despite the documentation here stating so.
Seeing as the the service bus API’s and earlier .NET client libraries support peeking scheduled messages directly on a topic, Azure.Messaging.ServiceBus should as well.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (3 by maintainers)
Top GitHub Comments
Hello @JoshLove-msft
I had worked around the issue, and have just only found the time to follow up on your response. I was not sure which overload of
CreateReceiver
you suggested I should use:public virtual ServiceBusReceiver CreateReceiver(string topicName, string subscriptionName)
with null or an empty string as subscriptionName orpublic virtual ServiceBusReceiver CreateReceiver(string queueName)
, so I wrote some tests to figure it out, and found some interesting results, you might be interested in.Using
CreateReceiver(string topicName, string subscriptionName)
with null or an empty string as subscriptionName, will work if I first schedule a message using a sender from the same underlying ServiceBusClient. But will mostly fail if I don’t schedule a message first, and just peek on an empty topic.Using
CreateReceiver(string queueName)
but passing the name of the topic rather than the name of a queue as the parameter suggests, always works. So I can confirm that it is possible to peek scheduled messages.The test:
I wish the documentation (and possible method signature) reflected that ´CreateReceiver(string queueName)´ can be used to peek scheduled messages on a topic. But will otherwise consider the issue resolved.
Hi kimpenhaus, only the original author of the issue can ask that it be unresolved. Please open a new issue with your scenario and details if you would like to discuss this topic with the team.