Exemple #1
0
 public static IJob Create(this IJobStore jobStore, string url, DateTime scheduledOn, string method = null)
 {
     if (jobStore == null)
     {
         throw new ArgumentNullException(nameof(jobStore));
     }
     return(jobStore.Queue(new JobDetails(url, scheduledOn, method)));
 }
Exemple #2
0
        /// <summary>
        /// Queues the job.
        /// </summary>
        /// <param name="job">The job.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">job</exception>
        public async Task <long> QueueAsync(Job job)
        {
            _ = job ?? throw new ArgumentNullException(nameof(job));
            var jobStateId = await stateManager.CreateAsync(job).ConfigureAwait(true);

            job.JobStateId = jobStateId;
            var jobId = managementStore.Queue(job);
            await stateManager.UpdateAsync(new JobStateUpdate { Id = jobStateId, JobId = jobId, Status = Status.Queued }).ConfigureAwait(true);

            return(jobStateId);
        }