title: How do I use an Azure Storage Queue in a request / response mode?
body: <p>As we port more of our node.js code into Azure Functions we see references in the Azure docs that using Storage Queues is the preferred way to delegate processing responsibility instead of using http requests to call other functions.</p>
  
  <p>What is the request/response design pattern we should use for this delegation?  Specifically, how can the response sent back through a queue be delivered only to the Function where the request originated?</p>
  
  <p>Here's an example of what we want to do:</p>
  
  <ol>
  <li>Request comes in to an HTTP Trigger Function A</li>
  <li>Function A places message into Queue X (in JSON format) with the first key being the unique requestId: "ABC345"</li>
  <li>Function A starts listening to Queue Y for the response</li>
  <li>Function B dequeues this message and does its work</li>
  <li>Function B places message with work results added into Queue Y with requestId: "ABC345"</li>
  <li>Function A sees this message with requestId: "ABC345" and returns the HTTP response</li>
  </ol>
  
  <p>How can we get Function A to pick up only the request that it is waiting for?</p>
  
  <p>The getMessage method doesn't seem to be able to selectively listen to a queue, only to grab the top message:</p>
  
  <pre><code>getMessage(queue [, options], callback)
  </code></pre>
  
  <p>Another angle on this would be if we want multiple Worker Functions to listen to Queue X.  Function C would process all requests that have requestType: "query" and Function D would process all requestType: "blob".  Without this filtering we would use one queue per Worker function.  Is that the right way to do it, too?</p>
  
  <p><em>Note: We're using node.js but I'm assuming that the Queue API's are equivalent across all SDK's.</em></p>