title: How to combine a controller with a listener?
body: <p>At my .NET Core HttpPost Controller I get data. This data I pass further for processing. The result about the success of the processing I can get only by setting up a listener. The result I get by the listener I want to return to the user.</p>
  
  <p><strong>But how can I make the Controller waiting for the listener and handle over the listener return as Controller return?</strong></p>
  
  <p>Example for illustrative purposes:</p>
  
  <pre><code>[HttpPost()]
  public async Task&lt;IActionResult&gt; CreatedAsync([FromBody]DataWrapper dataWrapper)
  {
      BusinessComponet.CollectData(dataWrapper);
      return returnValueFromListener; // How to do this in real?
  }
  
  static void BusinessComponentDeliverResponse(object sender, DeliverEventArgs e)
  {
      if(e.IsValid)
          return Ok("received");  // How to use this as return for the controller?
      else
          return BadRequest(e.ErrorMessage); // How to use this as return for the controller?
  }
  </code></pre>
  
  <p>The time span until getting the result in the listener will e around 7 seconds right now and I could get it in 1 second with some changes. I think it is ok to let the user wait for the result.</p>