title: Azure Service Bus: Maximum execution time of message processing
body: <p><strong>Short form of question</strong>: We want throw an exception if time spent processing a message exceeds a given limit.</p>
  <p><strong>Longer form of question</strong>: We have several on-premise applications running as Windows Services, listening to messages on an Azure Service Bus Subscription, and among other things writing to Azure Blob Storage.</p>
  <p>We have no problems with Service Bus or messaging in general. The service bus SDK seems to work perfectly.</p>
  <p>The problem is in our application logic, after having received a message, we do lots of calls to external services, like SQL server. Oracle DB, blob storage, web APIs. We found that calls to blob storage suddenly started to hang, i.e. nothing happening, and this happened in several applications at the same time on the same machine. The <em>symptom</em> was that messages was not processed. As the <em>problem</em> was calls to blob storage not responding for some reason, the <em>solution</em> was to set a MaximumExecutionTime on the blob client. With this in place, we get a TaskCanceledException after the specified timeout, instead of just waiting forever (until restart of the application)</p>
  <p>What I would like to know is if it possible to set a maximum execution time in the <em>SubsciptionClient</em>. Not for getting a message, but for our processing of the message. Or whether we would have to implement that in the callback (message handler) ourselves.</p>