我正在使用C#中的Quartz库编写Job Scheduler.我的要求是如果满足业务条件,我需要打电话给Apple服务器.
这就是我的Scheduler的样子: –
public class CustomerJob : BaseJob { private readonly ICustomerSchedulerService _customerSchedulerService; public CustomerJob (ICustomerSchedulerService customerSchedulerService) { _customerSchedulerService= customerSchedulerService; } public override void Execute(IJobExecutionContext context) { var customers = _customerSchedulerService.CheckExpiredTask(); foreach(var customer in customers) { //I need to make a post request to apple server for each customer //something like below however there is no HttpClient() available in this class //var client = new HttpClient(); //client.PostAsync("https://sandBox.itunes.apple.com/verifyReceipt",customer)); } base.Execute(context); } }
那么如何解决这个要求?
注意:-
我不希望将其移到API或基于Web的项目中,因为这个调度程序将从Web& API团队&其他).
谢谢.
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。