private static async Task CreateJob(IJobManager jobManager) { try { var jobId = await jobManager.CreateNewJobOrUpdateDefinition <SampleJobStep>( string.Empty, "sample-job", nameof(SampleJobStep), new JobConfigurationData { MaxBatchSize = 100, MaxConcurrentBatchesPerWorker = 5, IsIndefinite = true, MaxBlockedSecondsPerCycle = 300, QueueTypeName = QueueType.Redis }); var initialStep = new SampleJobStep { Number = 1 }; await Nebula.GetJobQueue <SampleJobStep>(QueueType.Redis).Enqueue(initialStep, jobId); await jobManager.StartJobIfNotStarted(string.Empty, nameof(SampleJobStep)); } catch (Exception e) { Console.WriteLine(e); throw; } }
public async Task <JobProcessingResult> Process(List <SampleJobStep> items) { var initialStep = new SampleJobStep { Number = _index }; var queue = _nebulaContext.GetJobQueue <SampleJobStep>(QueueType.Redis); await queue.Enqueue(initialStep, "sample-job"); _index++; return(new JobProcessingResult()); }