title: Singleton Azure function running as separate instances
body: <p>We have an Azure function that is supposed to be handling several service bus triggers at the same time and what I assume is happening is that it is being split across several instances which is causing some concurrency problems on our end.</p>
  
  <p>We need our function to act as a singleton so we can process requests one at a time without any collisions. From what we looked into in this article (<a href="https://docs.microsoft.com/en-us/azure/app-service/webjobs-sdk-how-to#singleton-attribute" rel="noreferrer">https://docs.microsoft.com/en-us/azure/app-service/webjobs-sdk-how-to#singleton-attribute</a>) we should be able to accomplish this.</p>
  
  <p>Our function looks like this:</p>
  
  <pre><code>[Microsoft.Azure.WebJobs.Singleton(Mode = SingletonMode.Listener)]
  [FunctionName("AccountCreatedSubscriber")]
  public static void Run([ServiceBusTrigger("accountscontacts-account-created", "license-keys", Connection = "FBISEventBus")]BrokeredMessage message, ILogger log)
  {
      log.LogInformation($"{{ Message received from accountscontacts-account-created topic }}");
  
      // Do Work
      log.LogInformation($"{{ Message sent to account creation handler }}");
  }
  </code></pre>
  
  <p>And for backup we also have this in our host.json file,</p>
  
  <pre><code>{
    "serviceBus": { "maxConcurrentCalls": 1 }
  }
  </code></pre>
  
  <p>But for whatever reason our functions are still running parallel. Any ideas?</p>