private void DeleteAllScopeJobs(IExecutionEntity scopeExecution, ITimerJobEntityManager timerJobEntityManager) { ICollection <ITimerJobEntity> timerJobsForExecution = timerJobEntityManager.FindJobsByExecutionId(scopeExecution.Id); foreach (ITimerJobEntity job in timerJobsForExecution) { timerJobEntityManager.Delete(job); } IJobEntityManager jobEntityManager = commandContext.JobEntityManager; ICollection <IJobEntity> jobsForExecution = jobEntityManager.FindJobsByExecutionId(scopeExecution.Id); foreach (IJobEntity job in jobsForExecution) { jobEntityManager.Delete(job); } ISuspendedJobEntityManager suspendedJobEntityManager = commandContext.SuspendedJobEntityManager; ICollection <ISuspendedJobEntity> suspendedJobsForExecution = suspendedJobEntityManager.FindJobsByExecutionId(scopeExecution.Id); foreach (ISuspendedJobEntity job in suspendedJobsForExecution) { suspendedJobEntityManager.Delete(job); } IDeadLetterJobEntityManager deadLetterJobEntityManager = commandContext.DeadLetterJobEntityManager; ICollection <IDeadLetterJobEntity> deadLetterJobsForExecution = deadLetterJobEntityManager.FindJobsByExecutionId(scopeExecution.Id); foreach (IDeadLetterJobEntity job in deadLetterJobsForExecution) { deadLetterJobEntityManager.Delete(job); } }
public override void EventCancelledByEventGateway(IExecutionEntity execution) { IJobEntityManager jobEntityManager = Context.CommandContext.JobEntityManager; IList <IJobEntity> jobEntities = jobEntityManager.FindJobsByExecutionId(execution.Id); foreach (IJobEntity jobEntity in jobEntities) { // Should be only one jobEntityManager.Delete(jobEntity); } Context.CommandContext.ExecutionEntityManager.DeleteExecutionAndRelatedData(execution, DeleteReasonFields.EVENT_BASED_GATEWAY_CANCEL, false); }