var scheduleJobId1 = _backgroundJobClient.Schedule(() => Console.WriteLine("Step One"), DateTimeOffset.Now.AddDays(5));
_backgroundJobClient.ContinueJobWith(scheduleJobId1, () => _backgroundJobClient.Schedule(() => Console.WriteLine("Step two"), TimeSpan.FromHours(7)), JobContinuationOptions.OnlyOnSucceededState);
_backgroundJobClient.ContinueJobWith(?2?, () => _backgroundJobClient.Schedule(() => Console.WriteLine("Step Three"), TimeSpan.FromHours(4)), JobContinuationOptions.OnlyOnSucceededState);我有三个连续的工作阶段。这些步骤必须按顺序安排。在第二步中,我在第一步中获得了作业ID,并使用HangFire中的ContinueJobWith方法,在第一步7小时后设置了第二步。现在我想在第二步4小时后设置第三步。为此,我需要第二个阶段作业ID,但是第二个作业被定义为lambda,那么我如何获得它的ID?
发布于 2021-05-05 13:00:01
试一试
var scheduleJobId1 = _backgroundJobClient.Schedule(() => Console.WriteLine("Step One"), DateTimeOffset.Now.AddDays(5));
_backgroundJobClient.ContinueWith(scheduleJobId1, () =>
_backgroundJobClient.ContinueWith(
_backgroundJobClient.Schedule(() => Console.WriteLine("Step two"), TimeSpan.FromHours(7)), () => _backgroundJobClient.Schedule(() => Console.WriteLine("Step Three"), TimeSpan.FromHours(4)), JobContinuationOptions.OnlyOnSucceededState),
JobContinuationOptions.OnlyOnSucceededState);https://stackoverflow.com/questions/67395045
复制相似问题