title: C# WebApi wait for WebHook response
body: <p>I have a web service that receives a post from a client, and eventually sends a request to a different web service hosted by another company. That company uses a Callback/Webhook model where you send in a request, they immediately reply with a 204, and then they send the finished result via http post to a url I have configured (its a long running process and sometimes can take a while).</p>
  
  <p>I would like to wait for a set amount of time to see if a response is returned timely from other company (like a 20 second timeout for example) and then return the results of the response from the other company. If they don't response within the timeout period, I will just return a generic result to my client with additional information about where they can get the rest of their data later. </p>
  
  <p>What I am trying to figure out is how I can have one API controller wait for a request into another API controller and then get the data from that controller. I am thinking some kind of event system would be appropriate: </p>
  
  <ol>
  <li>customer sends request to api endpoint on controller A </li>
  <li>Controller A registers a handler to an event raised by controller B </li>
  <li>3rd Party sends Http Request to controller B </li>
  <li>controller B publishes event that controller A is listening for along with data from 3rd party post</li>
  <li>controller A (if timeout is not reached) returns response to client</li>
  </ol>
  
  <p>There is quite a bit of utility code needed for this to work though. Is there a better way of handling a request/response model with a webhooks api?</p>