Reading Messages From Topic on storage blob through subscriber on Service Bus Explorer - C#

345 views Asked by At

Working Scenario:

  1. Post Msg1 to topic
  2. Post Msg2 to topic
  3. Read Msg1, Msg2

Not Working:

  1. Post Msg1 to topic
  2. Read Msg1 from topic through subscriber, but I'm not marking as complete.(Still on Queue)
  3. Post Msg2 to topic
  4. Read Msgs.. Actual: I read only Msg2 Expectation: Want to read Msg1, Msg2.

       if (namespaceManager.TopicExists(topic))
                    {
                        var lstOfValues = new List<SITConfirmation>();
                        SubscriptionClient Client = SubscriptionClient.CreateFromConnectionString(ConfigurationManager.ConectionString(), topic, subscriber);
                        IEnumerable<BrokeredMessage> messages = await Client.ReceiveBatchAsync(10, TimeSpan.FromMilliseconds(500));
                     }
    
1

There are 1 answers

0
Sean Feldman On BEST ANSWER

With ReceiveBatchAsync(messageCount) you're not promised to get the exact number of messages requested. Gateway could have all the messages or not. It will return whatever it has (gateway might have less/more/same number of messages that are actually stored on the broker entity).

From the documentation:

As this is an approximation, fewer or more messages than messageCount may be returned.