Quartz.Net - 提供自己的 DateTimeService
我有一个使用quartz.net 的应用程序,它是基于时间的,即某些作业在某些时间点执行。现在,为了测试的目的,我想提前托管服务器上的时间,以证明一切都按预期工作。我遇到的问题是在我们的公司网络上你无法提前时间,所有服务器、电脑都是同步的。
我想要做的是创建一个 DateTimeService,我的应用程序将在需要获取当前日期时间的任何时候使用它。对我来说听起来不错,问题出在哪里,无论如何我可以让quartz.net使用这个服务吗???
任何建议将不胜感激。
I have an application that is using quartz.net which is time based i.e. certain jobs execute at certain points of time. Now for the purpose of testing I want to advance time on the hosting server to prove that all works as intended. The problem I have is on our corporate network you cant advance time, all the servers, pcs are synchronised.
What I wanted to do is create a DateTimeService that my application would use anytime it needed to get the current datetime. Sounds good to me, where the problem lies is there anyway I can make quartz.net use this service???
Any advice would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恕我直言,您可以替换静态类
SystemTime
中的 func 委托:https://github.com/quartznet/quartznet/blob/master/src/Quartz/SystemTime.cs
通过设置设置
为静态时间,或者将其替换为 func delegate为您服务。
Imho you can replace the func delegate in the static class
SystemTime
:https://github.com/quartznet/quartznet/blob/master/src/Quartz/SystemTime.cs
by setting
to set to a static time, or replace it with a func delegate to your service.