public async Task PurgeQueue_CustomeJobQueueDefinedInJob_shouldBeEmpty() { //create sample job with custom queue var jobManager = Nebula.GetJobManager(); var jobStore = Nebula.ComponentContext.GetComponent <IJobStore>(); Nebula.RegisterJobQueue(typeof(FirstJobQueue <FirstJobStep>), QueueTypes.FirstJobQueue); var jobId = await jobManager.CreateNewJobOrUpdateDefinition <FirstJobStep>( String.Empty, "sample-job", nameof(FirstJobStep), new JobConfigurationData { MaxBatchSize = 100, MaxConcurrentBatchesPerWorker = 5, IsIndefinite = true, MaxBlockedSecondsPerCycle = 300, QueueTypeName = QueueTypes.FirstJobQueue }); var jobData = await jobStore.LoadFromAnyTenant(jobId); var jobQueue = Nebula.GetJobQueue <FirstJobStep>(jobData.Configuration.QueueTypeName); await jobQueue.Enqueue(new FirstJobStep(), jobData.JobId); await jobQueue.PurgeQueueContents(jobData.JobId); var queueLeghnt = await jobQueue.GetQueueLength(); Assert.AreEqual(0, queueLeghnt); }
public async Task QueueType_CreateCustome_Success() { //create sample job with custom queue Nebula.RegisterJobQueue(typeof(FirstJobQueue <>), QueueTypes.FirstJobQueue); var jobManager = Nebula.GetJobManager(); var jobStore = Nebula.ComponentContext.GetComponent <IJobStore>(); var jobId = await jobManager.CreateNewJobOrUpdateDefinition <FirstJobStep>( string.Empty, "sample-job", nameof(FirstJobStep), new JobConfigurationData { MaxBatchSize = 100, MaxConcurrentBatchesPerWorker = 5, IsIndefinite = true, MaxBlockedSecondsPerCycle = 300, QueueTypeName = QueueTypes.FirstJobQueue }); var jobData = await jobStore.LoadFromAnyTenant(jobId); var jobQueue = Nebula.GetJobQueue <FirstJobStep>(jobData.Configuration.QueueTypeName); Assert.AreEqual(typeof(FirstJobQueue <FirstJobStep>), jobQueue.GetType()); }