public static async Task EnqueueBatch <TItem>(this IDelayedJobQueue <TItem> delayedQueue, IEnumerable <TItem> items, TimeSpan delay) where TItem : IJobStep { var steps = items.Select(item => new Tuple <TItem, TimeSpan>(item, delay)).ToList(); await delayedQueue.EnqueueBatch(steps); }
public void Initialize(JobData jobData, NebulaContext nebulaContext) { if (jobData == null) { throw new ArgumentNullException(nameof(jobData), ErrorKeys.ParameterNull); } if (nebulaContext == null) { throw new ArgumentNullException(nameof(nebulaContext), ErrorKeys.ParameterNull); } _jobId = jobData.JobId; _jobQueue = nebulaContext.JobStepSourceBuilder.BuildDelayedJobQueue <HttpPushOutgoingQueueStep>(_jobId); var parametersString = jobData.Configuration?.Parameters; if (string.IsNullOrWhiteSpace(parametersString)) { throw new ArgumentNullException(nameof(jobData.Configuration.Parameters), ErrorKeys.ParameterNull); } _parameters = JsonConvert.DeserializeObject <HttpPushOutgoingQueueParameters>(parametersString); }
public static async Task Enqueue <TItem>(this IDelayedJobQueue <TItem> delayedQueue, TItem item, TimeSpan delay) where TItem : IJobStep { var step = new Tuple <TItem, TimeSpan>(item, delay); await delayedQueue.EnqueueBatch(step.Yield()); }
public static async Task Enqueue <TItem>(this IDelayedJobQueue <TItem> delayedQueue, TItem item, DateTime processTime) where TItem : IJobStep { var step = new Tuple <TItem, DateTime>(item, processTime); await delayedQueue.EnqueueBatch(step.Yield()); }