如何安排作业在Hangfire中的特定日期执行

编程入门 行业动态 更新时间:2024-10-09 14:21:19
本文介绍了如何安排作业在Hangfire中的特定日期执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Hangfire.io支持对重复作业进行类似于CRON的调度.但是我如何指定特定的作业应该在特定的日期/时间运行一次,例如应该在2016年6月4日的16:22上运行作业-并且只能在该特定时间点进行?

Hangfire.io supports making a CRON-like scheduling of recurring jobs. But how do I specify, that a specific job should be run once, at a specific date/time, e.g. that a job should be run June 4th 2016, at 16:22 - and only at that specific point in time?

问相同问题的类似方法可能是:CRON表达式的子集描述了多大这里,由Hangfire支持吗?(所描述的CRON表达式支持可以使用的年份"字段.)

A similar way to ask the same question could be: how large a subset of the CRON expression described here, is supported by Hangfire? (The described CRON expression supports a "Year"-field which could be used).

此外,如果我使用Hangfire进行作业处理,那么您认为Hangfire首先是安排一次性批处理作业的最佳选择吗?

Also, do you think Hangfire is the best choice to schedule one-off batch jobs in the first place, provided that I use Hangfire for job processing?

推荐答案

您可以使用BackgroundJob.Schedule(Expression> methodCall,DateTimeOffsetdt)方法.

You can use BackgroundJob.Schedule(Expression> methodCall, DateTimeOffsetdt) method.

BackgroundJob.Schedule(methodCall, enqueueAt);

更多推荐

如何安排作业在Hangfire中的特定日期执行

本文发布于:2023-11-24 12:07:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1625136.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业   日期   Hangfire

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!