public void ScheduleTimeout(IResumableActivity activityInstance, WorkflowRun workflowRun, decimal timeoutMinutes) { timeoutAction = () => { var workflowEvent = new TimeoutEvent(); WorkflowRunner.Instance.ResumeWorkflow(workflowRun, workflowEvent); }; }
public void ScheduleTimeout(IResumableActivity activityInstance, WorkflowRun workflowRun, decimal timeoutMinutes) { var pointInTime = DateTimeOffset.UtcNow.AddMinutes((double)timeoutMinutes); string triggerId = string.Format("Timeout trigger {0}", workflowRun.Id); // Define the Job to be scheduled var builder = JobBuilder.Create <TimeoutActivityJob>() .WithIdentity(GetJobId(workflowRun)) .UsingJobData(TimeoutActivityJob.RunIdKey, workflowRun.Id.ToString()) .UsingCurrentTenant() .RequestRecovery(); var job = builder.Build(); // Associate a trigger with the Job var trigger = TriggerBuilder.Create() .WithIdentity(triggerId, TimeoutSchedulingGroup) .StartAt(pointInTime) .Build(); SchedulingHelper.Instance.ScheduleJob(job, trigger); }