在Azure,我有一个WebAPI和一个WebJob。WebAPI向Azure服务总线队列发送消息,WebJob是该队列中唯一的订阅者。当WebJob最后确定处理作业时,它如何将响应消息传递给WebAPI?
发布于 2017-09-26 02:54:53
您可以创建一个API来接受来自WebJob的响应。下面的代码供您参考。
public class WebJobResponseController : ApiController
{
public string Get(string token, string value)
{
//use the token to validate the webjob, use the value to post any data which you want to send to API
return "success";
}
}在您的WebJob端,在处理作业之后,只需要向高级API发送一个请求。下面的代码供您参考。
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("URL of your API");
await client.GetAsync("WebJobResponse?token=token1&value=value1");https://stackoverflow.com/questions/46407705
复制相似问题