I'm using Microsoft.Azure.ServiceBus namespace to connect to a Service Bus topic. I'm looking for a way to retrieve messages from a subscription iteratively as it was possible using the Microsoft.ServiceBus.Messaging namespace? I'm looking for something similar:
SubscriptionClient subscriptionClient = SubscriptionClient.CreateFromConnectionString(ServiceBusConnectionString, TopicName, SubscriptionName);
while(true)
{
BrokeredMessage brokeredMessage = subscriptionClient.ReceiveAsync().Result;
var strBody = brokeredMessage.GetBody<Stream>();
StreamReader streamReader = new StreamReader(strBody);
Console.WriteLine(streamReader.ReadToEnd());
brokeredMessage.Complete();
}
AFAIK, Microsoft.Azure.ServiceBus library provides the only option of using subscriptionClient.RegisterMessageHandler which uses the underlying Message Pump.
However, in the event of an outage at the subscriber application and if it needs to read the pending unread messages from the Subscription, it needs to do a Receive or ReceiveAsync
Is my assumption correct?