Пример #1
0
        private void DeleteScheduledJob(RunHangfireWorkflowDefinitionJobModel data)
        {
            var jobId = _jobStorage
                        .EnumerateScheduledJobs <RunHangfireWorkflowDefinitionJob, RunHangfireWorkflowDefinitionJobModel>(x => x.WorkflowDefinitionId == data.WorkflowDefinitionId && x.ActivityId == data.ActivityId)
                        .Select(x => x.Key)
                        .FirstOrDefault();

            if (jobId == null)
            {
                return;
            }

            DeleteScheduledJob(jobId);
        }
Пример #2
0
        private void DeleteRecurringJob(RunHangfireWorkflowDefinitionJobModel data)
        {
            var identity = data.GetIdentity();

            _recurringJobManager.RemoveIfExists(identity);
        }
Пример #3
0
        private void ScheduleRecurringJob(RunHangfireWorkflowDefinitionJobModel data, string cronExpression)
        {
            var identity = data.GetIdentity();

            _recurringJobManager.AddOrUpdate <RunHangfireWorkflowDefinitionJob>(identity, job => job.ExecuteAsync(data), cronExpression);
        }
Пример #4
0
 private void ScheduleJob(RunHangfireWorkflowDefinitionJobModel data, Instant instant) => _backgroundJobClient.Schedule <RunHangfireWorkflowDefinitionJob>(job => job.ExecuteAsync(data), instant.ToDateTimeOffset());