title: SubscriptionClient.RecieveBatch not retrieving all the brokered messages
body: <p>I have a console application to read all the brokered messages present in the subscription on the Azure Service Bus. I have around 3500 messages in there. This is my code to read the messages:</p>
  
  <pre><code>SubscriptionClient client = messagingFactory.CreateSubscriptionClient(topic, subscription);   
  long count = namespaceManager.GetSubscription(topic, subscription).MessageCountDetails.ActiveMessageCount;
  Console.WriteLine("Total messages to process : {0}", count.ToString()); //Here the number is showing correctly
  IEnumerable&lt;BrokeredMessage&gt; dlIE = null;
  dlIE = client.ReceiveBatch(Convert.ToInt32(count));
  </code></pre>
  
  <p>When I execute the code, in the dlIE, I can see only 256 messages. I have also tried giving the prefetch count like this <code>client.PrefetchCount</code>but then also it returns 256 messages only.</p>
  
  <p>I think there is some limit to the number of messages that can be retrieved at a time.However there is no such thing mentioned on the msdn page for the <code>RecieveBatch</code> method. What can I do to retrieve all messages at a time?</p>
  
  <p><strong>Note:</strong></p>
  
  <ol>
  <li><p>I only want to read the message and then let it exist on the service bus. Therefore I do not use <code>message.complete</code> method.</p></li>
  <li><p>I cannot remove and re-create the topic/subscription from the Service Bus.</p></li>
  </ol>
  
  <p><strong>Edit:</strong></p>
  
  <p>I used PeekBatch instead of ReceiveBatch like this:</p>
  
  <pre><code>    IEnumerable&lt;BrokeredMessage&gt; dlIE = null;
                              List&lt;BrokeredMessage&gt; bmList = new List&lt;BrokeredMessage&gt;();
    long i = 0;
     dlIE = subsciptionClient.PeekBatch(Convert.ToInt32(count)); // count is the total number of messages in the subscription.
    bmList.AddRange(dlIE);
    i = dlIE.Count();
   if(i &lt; count)
    {           
   while(i &lt; count)
    {
    IEnumerable&lt;BrokeredMessage&gt; dlTemp = null;
     dlTemp = subsciptionClient.PeekBatch(i, Convert.ToInt32(count));
      bmList.AddRange(dlTemp);
      i = i + dlTemp.Count();
      }
      }
  </code></pre>
  
  <p>I have <strong>3255</strong> messages in the subscription. When the first time peekBatch is called it gets 250 messages. so it goes into the while loop with <code>PeekBatch(250,3225)</code>. Every time 250 messages are only received. The final total messages I am having in the output list is <strong>3500</strong> with duplicates. I am not able to understand how this is happening. </p>