protected internal virtual void SendCancelEvent(IDeadLetterJobEntity jobToDelete) { if (Context.ProcessEngineConfiguration.EventDispatcher.Enabled) { Context.ProcessEngineConfiguration.EventDispatcher.DispatchEvent(ActivitiEventBuilder.CreateEntityEvent(ActivitiEventType.JOB_CANCELED, jobToDelete)); } }
/// <summary> /// /// </summary> /// <param name="otherJob"></param> /// <returns></returns> protected internal virtual IDeadLetterJobEntity CreateDeadLetterJobFromOtherJob(IAbstractJobEntity otherJob) { IDeadLetterJobEntity deadLetterJob = processEngineConfiguration.DeadLetterJobEntityManager.Create(); CopyJobInfo(deadLetterJob, otherJob); return(deadLetterJob); }
public virtual object Execute(ICommandContext commandContext) { IDeadLetterJobEntity jobToDelete = GetJobToDelete(commandContext); SendCancelEvent(jobToDelete); commandContext.DeadLetterJobEntityManager.Delete(jobToDelete); return(null); }
/// <summary> /// /// </summary> /// <param name="job"></param> /// <returns></returns> public virtual IDeadLetterJobEntity MoveJobToDeadLetterJob(IAbstractJobEntity job) { IDeadLetterJobEntity deadLetterJob = CreateDeadLetterJobFromOtherJob(job); processEngineConfiguration.DeadLetterJobEntityManager.Insert(deadLetterJob); if (job is ITimerJobEntity) { processEngineConfiguration.TimerJobEntityManager.Delete((ITimerJobEntity)job); } else if (job is IJobEntity) { processEngineConfiguration.JobEntityManager.Delete((IJobEntity)job); } return(deadLetterJob); }
protected internal virtual IDeadLetterJobEntity GetJobToDelete(ICommandContext commandContext) { if (ReferenceEquals(timerJobId, null)) { throw new ActivitiIllegalArgumentException("jobId is null"); } //if (log.DebugEnabled) //{ // log.debug("Deleting job {}", timerJobId); //} IDeadLetterJobEntity job = commandContext.DeadLetterJobEntityManager.FindById <IDeadLetterJobEntity>(new KeyValuePair <string, object>("id", timerJobId)); if (job == null) { throw new ActivitiObjectNotFoundException("No dead letter job found with id '" + timerJobId + "'", typeof(IJob)); } return(job); }
/// <summary> /// /// </summary> /// <param name="deadLetterJobEntity"></param> /// <param name="retries"></param> /// <returns></returns> public virtual IJobEntity MoveDeadLetterJobToExecutableJob(IDeadLetterJobEntity deadLetterJobEntity, int retries) { if (deadLetterJobEntity == null) { throw new ActivitiIllegalArgumentException("Null job provided"); } IJobEntity executableJob = CreateExecutableJobFromOtherJob(deadLetterJobEntity); executableJob.Retries = retries; bool insertSuccesful = processEngineConfiguration.JobEntityManager.InsertJobEntity(executableJob); if (insertSuccesful) { processEngineConfiguration.DeadLetterJobEntityManager.Delete(deadLetterJobEntity); TriggerExecutorIfNeeded(executableJob); return(executableJob); } return(null); }
public virtual IJobEntity Execute(ICommandContext commandContext) { if (jobId is null) { throw new ActivitiIllegalArgumentException("jobId and job is null"); } IDeadLetterJobEntity job = commandContext.DeadLetterJobEntityManager.FindById <IDeadLetterJobEntity>(new KeyValuePair <string, object>("id", jobId)); if (job == null) { throw new JobNotFoundException(jobId); } if (log.IsEnabled(LogLevel.Debug)) { log.LogDebug($"Moving deadletter job to executable job table {job.Id}"); } return(commandContext.JobManager.MoveDeadLetterJobToExecutableJob(job, retries)); }