2021年5月4日星期二

Get method output from a lambda expression in HangFire ContinueJobWith Method

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);  

I have three stages of consecutive jobs. These steps must be scheduled in sequence. In the second step, I got the job ID in the first step And using the ContinueJobWith ​​method in HangFire, I set the second step 7 hours after the first step. Now I want to set the third step 4 hours after the second step. To do this, I need the second stage job ID But the second job is defined as lambda , so how do I get its ID?

https://stackoverflow.com/questions/67395045/get-method-output-from-a-lambda-expression-in-hangfire-continuejobwith-method May 05, 2021 at 12:03PM

没有评论:

发表评论