public async Task Execute(JobLocator jobLocator, bool jobIsCompleted) { try { var job = await jobRepo.Get(jobLocator.SubscriptionName, jobLocator.JobIdentifier); if (job == null) { logger.LogError($"Job meta data could not be found for SubscriptionName {jobLocator.SubscriptionName} and JobIdentifier {jobLocator.JobIdentifier}. " + "This should never happen, probably means there's a bug in the scheduler or somebody has manually messed with the scheduling DB"); return; } await serviceBus.EnsureSubscriptionIsSetup(jobLocator.SubscriptionName); await serviceBus.PublishEventToTopic(jobLocator.SubscriptionName, JsonConvert.SerializeObject(job)); if (jobIsCompleted) { await jobRepo.Delete(jobLocator.SubscriptionName, jobLocator.JobIdentifier); } } catch (Exception e) { logger.LogError(e, "Error in JobExecute logic"); } }
private static string JobLocatorToPath(JobLocator jobLocator) => $"/api/Job/{jobLocator.SubscriptionName}/{jobLocator.JobIdentifier}";
public async Task <Job> GetJob(JobLocator jobLocator) { return(await GetAsync <Job>(JobLocatorToPath(jobLocator), functionKeys.GetJob)); }
public async Task DeleteJob(JobLocator jobLocator) { await DeleteAsync(JobLocatorToPath(jobLocator), functionKeys.DeleteJob); }
public async Task DeleteJob(JobLocator jobLocator, CancellationToken ct) { await RemoveJobIfAlreadyExists(jobLocator.JobIdentifier, jobLocator.SubscriptionName, ct); }