public virtual object Execute(ICommandContext commandContext) { CommandConfig commandConfig = outerInstance.processEngineConfiguration.CommandExecutor.DefaultConfig.TransactionRequiresNew(); IFailedJobCommandFactory failedJobCommandFactory = commandContext.FailedJobCommandFactory; ICommand <object> cmd = failedJobCommandFactory.GetCommand(outerInstance.job.Id, exception); log.LogTrace($"Using FailedJobCommandFactory '{failedJobCommandFactory.GetType()}' and command of type '{cmd.GetType()}'"); outerInstance.processEngineConfiguration.CommandExecutor.Execute(commandConfig, cmd); // Dispatch an event, indicating job execution failed in a // try-catch block, to prevent the original exception to be swallowed if (commandContext.EventDispatcher.Enabled) { try { commandContext.EventDispatcher.DispatchEvent(ActivitiEventBuilder.CreateEntityExceptionEvent(ActivitiEventType.JOB_EXECUTION_FAILURE, outerInstance.job, exception)); } catch (Exception ignore) { log.LogWarning(ignore, "Exception occurred while dispatching job failure event, ignoring."); } } return(commandContext.GetResult()); }
public CommandContext(ICommand <T1> command, ProcessEngineConfigurationImpl processEngineConfiguration) { this.command = command; this.processEngineConfiguration = processEngineConfiguration; failedJobCommandFactory = processEngineConfiguration.FailedJobCommandFactory; sessionFactories = processEngineConfiguration.SessionFactories ?? new ConcurrentDictionary <Type, ISessionFactory>(); agenda = processEngineConfiguration.EngineAgendaFactory.CreateAgenda(this); }
public CommandContext(ProcessEngineConfigurationImpl processEngineConfiguration, ITransactionContextFactory transactionContextFactory, IScope scope) { Scope = scope; this.processEngineConfiguration = processEngineConfiguration; failedJobCommandFactory = processEngineConfiguration.FailedJobCommandFactory; //sessionFactories = processEngineConfiguration.SessionFactories; transactionContext = transactionContextFactory.OpenTransactionContext(this); RestrictUserOperationLogToAuthenticatedUsers = processEngineConfiguration.RestrictUserOperationLogToAuthenticatedUsers; }
public virtual void CloseFailure(ICommandContext commandContext) { if (commandContext.EventDispatcher.Enabled) { commandContext.EventDispatcher.DispatchEvent(ActivitiEventBuilder.CreateEntityExceptionEvent(ActivitiEventType.JOB_EXECUTION_FAILURE, job, commandContext.Exception)); } CommandConfig commandConfig = commandExecutor.DefaultConfig.TransactionRequiresNew(); IFailedJobCommandFactory failedJobCommandFactory = commandContext.FailedJobCommandFactory; ICommand <object> cmd = failedJobCommandFactory.GetCommand(job.Id, commandContext.Exception); log.LogTrace("Using FailedJobCommandFactory '" + failedJobCommandFactory.GetType() + "' and command of type '" + cmd.GetType() + "'"); commandExecutor.Execute(commandConfig, cmd); }