title: How to use await with hangfire background job?
body: <p>I am using hangfire with .net core 2.1. Now the issue is I am using httpclient for making multiple web requests and hangfire doesn't support async methods I think. So the response return before all the web requests are completed. I have commented this line:</p>
  
  <pre><code>_backgroundJob.Enqueue(() =&gt; EnqueueMyMethodCallBack(email)); 
  </code></pre>
  
  <p>and used this line:</p>
  
  <pre><code>await EnqueueMyMethodCallBack(email)
  </code></pre>
  
  <p>then it was working fine. So is there any way I can await _backgroundJob.Enqueue ? Also I have found this article <a href="https://www.hangfire.io/blog/2016/07/16/hangfire-1.6.0.html" rel="nofollow noreferrer">https://www.hangfire.io/blog/2016/07/16/hangfire-1.6.0.html</a> where it was written that async methods are now supported but I still can't use them. </p>
  
  <p>And the EnqueueMyMethodCallBack method:</p>
  
  <pre><code>public async Task&lt;bool&gt; EnqueueMyMethodCallBack(string email)
  {
    var response = await _userRepo.GetUser(email);
    if(response == null)
      return false;
    var template = await _template.GetTemplate();
    await _email.Send(template, email);
    return true; 
  }
  </code></pre>
  
  <p>Any help?</p>