title: Services bus message receive in Azure Function
body: <p>I created one ServicesBus queue and start sending thousands of messages</p>
  
  <pre><code>await queueClient.SendBatchAsync(brokeredMessagesList);
  </code></pre>
  
  <p>Another side I created azure function to receive messages form ServicesBus  queue. here is my code</p>
  
  <pre><code>public static async Task RunAsync([ServiceBusTrigger("batch-input", AccessRights.Manage,
          Connection = "ServiceBusConnection")]BrokeredMessage message, TraceWriter log)
      {
          string body;
          using (var stream = message.GetBody&lt;Stream&gt;())
          using (var streamReader = new StreamReader(stream, Encoding.UTF8))
          {
              body = await streamReader.ReadToEndAsync();
          }
          SampleMessage sampleMessage = JsonConvert.DeserializeObject&lt;SampleMessage&gt;(body);
  
          await SaveMessageIntoAzureTableAsync(sampleMessage);
          //await message.CompleteAsync();
          log.Info($"Message body: {sampleMessage}");
      }
  </code></pre>
  
  <p>This code working in my local but I'm more curious about scaling and batch processing.</p>
  
  <p>How azure function scaling will work with large no of message in queue?? I don't see any documentation</p>
  
  <p>Prefetch Count setting will apply on local? <a href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-performance-improvements#prefetching" rel="nofollow noreferrer">here</a> I saw default prefetching count is 100. </p>
  
  <p>When should I call complete method (with or without this my code is working)?</p>
  
  <pre><code>await message.CompleteAsync();
  </code></pre>