title: How to host a Service Bus Message Receiver in Azure
body: <p>I have some problem with hosting of Service Bus receiver in Azure, not sure which service is best suited for this (WebJobs / Container Instances / ? ).</p>
  <p>Basically currently using Azure Functions mixed Timer Triggers and Service Bus Triggers.</p>
  <p>However, both has their downsides.</p>
  <p>For Service Bus Triggers - the main downside is, that if having lot of queues and functions listening on these queues, it's not possible to really finely grain control those, like - I can set for example maxConcurrentCalls or autoComplete in host.json, but the problem is this affects all of the functions, and it's not easy to throttle the throughput.</p>
  <p>With Timer Triggers, there is bit more control, since I can instantiate the MessageReceiver and then fetch some configured number of messages from queue for processing like each minute for example. But sometimes the problem is that there is some limit of messages that can be fetched (like I set max to 300, but it fetches only 100-200), also cannot really use the features like PrefetchCount since the MessageReceiver is not long lived, it's instantiated while the function is executing, and disposed when function ends.</p>
  <p>I was thinking to host the MessageReceivers in some kind of long running process to have all of the benefits of fine grained control over it, but not really sure what's best/recommended  Azure service to achieve that. I was thinking that perhaps a Continous WebJob or some kind of simple container hosting, any suggestions ?</p>
  <p>The idea is that is triggers on messages arriving on queue, but there is an option to throttle the throughput with setting like max concurrency, basically having something like Service Bus Trigger, but with with the ability to set up/configure each receiver individually.</p>
  <p>Thanks</p>