public void ExecuteCommands(ObjectTypeId objectTypeId, ICommandExecutor commandExecutor, CompositeCommandExecutionContext compositeContext)
 {
     foreach (var command in commands)
     {
         var context = compositeContext.GetFor(command.TargetObjectId);
         commandExecutor.Execute(command, context);
     }
 }
 public void ExecuteCommands(ObjectId targetObjectId, ICommandExecutor commandExecutor, ICommandExecutionContext context)
 {
     List<AbstractCommand> commandsForObject;
     if (!commands.TryGetValue(targetObjectId, out commandsForObject))
     {
         return;
     }
     foreach (var command in commandsForObject)
     {
         commandExecutor.Execute(command, context);
     }
 }
Пример #3
0
        public void 回退到任务已完成节点(string bpmnFile)
        {
            string xml = IntegrationTestContext.ReadBpmn(bpmnFile);

            ICommandExecutor commandExecutor = (processEngine.ProcessEngineConfiguration as ProcessEngineConfigurationImpl).CommandExecutor;

            Authentication.AuthenticatedUser = new InProcessWorkflowEngine.TestUser()
            {
                Id       = "评审员",
                FullName = "评审员",
                TenantId = context.TenantId
            };

            IDeploymentBuilder builder = processEngine.RepositoryService.CreateDeployment()
                                         .Name(Path.GetFileNameWithoutExtension(bpmnFile))
                                         .TenantId(context.TenantId)
                                         .AddString(bpmnFile, xml)
                                         .EnableDuplicateFiltering()
                                         .TenantId(context.TenantId);

            IDeployment deploy = commandExecutor.Execute(new DeployCmd(builder));

            IProcessDefinition definition = processEngine.RepositoryService.CreateProcessDefinitionQuery()
                                            .SetDeploymentId(deploy.Id)
                                            .SetProcessDefinitionTenantId(context.TenantId)
                                            .SetLatestVersion()
                                            .SingleResult();

            IProcessInstance processInstance = commandExecutor.Execute(new StartProcessInstanceCmd(definition.Id, null));

            try
            {
                IList <ITask> tasks = processEngine.TaskService.GetMyTasks("节点1");

                ITaskEntity      task      = tasks[0] as ITaskEntity;
                IExecutionEntity execution = commandExecutor.Execute(new GetExecutionByIdCmd(task.ExecutionId));

                processEngine.TaskService.Complete(task.Id, new Dictionary <string, object>
                {
                    { "流程变量", "变量值" }
                });

                tasks = processEngine.TaskService.GetMyTasks("节点2");
                task  = tasks[0] as ITaskEntity;
                processEngine.TaskService.Complete(task.Id, new Dictionary <string, object>
                {
                    { "流程变量", "变量值" }
                });

                var list = commandExecutor.Execute(new GetCompletedTaskModelsCmd(task.ProcessInstanceId, true));

                tasks = processEngine.TaskService.GetMyTasks("节点3");
                task  = tasks[0] as ITaskEntity;

                commandExecutor.Execute(new ReturnToActivityCmd(task.Id, list[0].Id, $"回退测试到{list[0].Name}"));
            }
            catch
            {
            }

            System.Diagnostics.Debugger.Break();
        }
Пример #4
0
        public bool Execute(ICommandContext commandContext)
        {
            try
            {
                ICommandExecutor commandExecutor = commandContext.ProcessEngineConfiguration.CommandExecutor;

                List <IProcessInstance> processInstances = new List <IProcessInstance>();

                if (string.IsNullOrWhiteSpace(processInstanceId) == false)
                {
                    if (!(commandExecutor.Execute(new GetProcessInstanceByIdCmd(processInstanceId)) is IProcessInstance processInstance))
                    {
                        throw new ActivitiObjectNotFoundException(string.Concat("Unable to find process instance for the given id: ", processInstanceId));
                    }

                    processInstances.Add(processInstance);
                }
                else if (string.IsNullOrWhiteSpace(businessKey) == false)
                {
                    IRuntimeService runtimeService = commandContext.ProcessEngineConfiguration.RuntimeService;

                    IProcessInstanceQuery query = runtimeService.CreateProcessInstanceQuery()
                                                  .SetProcessInstanceBusinessKey(businessKey);

                    if (query is ProcessInstanceQueryImpl pqi)
                    {
                        pqi.IncludeChildExecutionsWithBusinessKeyQuery = false;
                    }

                    var list = commandExecutor.Execute(new GetProcessInstancesCmd(query, 0, int.MaxValue));

                    if (list.Count == 0)
                    {
                        throw new ActivitiObjectNotFoundException(string.Concat("Unable to find process instance for the given businessKey: ", businessKey));
                    }

                    processInstances.AddRange(list);
                }

                foreach (IProcessInstance processInstance in processInstances)
                {
                    IProcessDefinition processDefinition = commandExecutor.Execute(new GetDeploymentProcessDefinitionCmd(processInstance.ProcessDefinitionId));
                    if (processDefinition is null)
                    {
                        throw new ActivitiObjectNotFoundException(string.Concat("Unable to find process definition for the given id: ", processInstance.ProcessDefinitionId));
                    }

                    commandExecutor.Execute(new SetExecutionVariablesCmd(processInstance.Id, variables, false));

                    string delReason = reason ?? "Cancelled";

                    IList <ITask> tasks = commandExecutor.Execute(new GetTasksByProcessInstanceIdCmd(new string[] { processInstance.Id }));

                    foreach (var task in tasks)
                    {
                        commandExecutor.Execute(new AddCommentCmd(task.Id, processInstance.Id, delReason));
                    }

                    commandExecutor.Execute(new DeleteProcessInstanceCmd(processInstance.Id, delReason));
                }
            }
            catch (NullReferenceException ex)
            {
                logger.LogError($"终止流程失败:{ex.StackTrace}");
                throw;
            }

            return(true);
        }
 /// <inheritdoc />
 /// <summary>
 /// Deletes a subscription record from the SQL database
 /// </summary>
 /// <param name="topic">The name of the topic</param>
 /// <param name="subscriber">The base URI of the subscribing Platibus instance</param>
 /// <returns>Returns a task that will complete when the subscription record
 /// has been deleted</returns>
 protected override Task DeleteSubscription(TopicName topic, Uri subscriber)
 {
     CheckDisposed();
     return(_commandExecutor.Execute(
                () => base.DeleteSubscription(topic, subscriber)));
 }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        public virtual void Run()
        {
            Thread.CurrentThread.Name = "activiti-acquire-async-jobs";
            log.LogInformation($"{Thread.CurrentThread.Name} starting to acquire async jobs due");

            ICommandExecutor commandExecutor = asyncExecutor.ProcessEngineConfiguration.CommandExecutor;

            while (!isInterrupted)
            {
                try
                {
                    AcquiredJobEntities acquiredJobs = commandExecutor.Execute(new AcquireJobsCmd(asyncExecutor));

                    if (acquiredJobs is object)
                    {
                        bool allJobsSuccessfullyOffered = true;
                        foreach (IJobEntity job in acquiredJobs.Jobs)
                        {
                            bool jobSuccessFullyOffered = asyncExecutor.ExecuteAsyncJob(job);
                            if (!jobSuccessFullyOffered)
                            {
                                allJobsSuccessfullyOffered = false;
                            }
                        }

                        // If all jobs are executed, we check if we got back the amount we expected
                        // If not, we will wait, as to not query the database needlessly.
                        // Otherwise, we set the wait time to 0, as to query again immediately.
                        millisToWait = asyncExecutor.DefaultAsyncJobAcquireWaitTimeInMillis;
                        int jobsAcquired = acquiredJobs.Size();
                        if (jobsAcquired >= asyncExecutor.MaxAsyncJobsDuePerAcquisition)
                        {
                            millisToWait = 0;
                        }

                        // If the queue was full, we wait too (even if we got enough jobs back), as not overload the queue
                        if (millisToWait == 0 && !allJobsSuccessfullyOffered)
                        {
                            millisToWait = asyncExecutor.DefaultQueueSizeFullWaitTimeInMillis;
                        }
                    }
                }
                catch (ActivitiOptimisticLockingException optimisticLockingException)
                {
                    if (log.IsEnabled(LogLevel.Debug))
                    {
                        log.LogDebug($@"Optimistic locking exception during async job acquisition. 
If you have multiple async executors running against the same database, this exception means that this thread tried to acquire a due async job, 
which already was acquired by another async executor acquisition thread.
This is expected behavior in a clustered environment. 
You can ignore this message if you indeed have multiple async executor acquisition threads running against the same database. Exception message: {optimisticLockingException.Message}");
                    }
                }
                catch (Exception e)
                {
                    log.LogDebug($"exception during async job acquisition: {e.Message}");
                    millisToWait = asyncExecutor.DefaultAsyncJobAcquireWaitTimeInMillis;
                }

                if (millisToWait > 0)
                {
                    try
                    {
                        //if (log.IsEnabled(LogLevel.Debug))
                        //{
                        //    log.LogDebug($"async job acquisition thread sleeping for {millisToWait} millis");
                        //}
                        lock (MONITOR)
                        {
                            if (!isInterrupted)
                            {
                                isWaiting = true;//.set(true);
                                Monitor.Wait(MONITOR, TimeSpan.FromMilliseconds(millisToWait));
                            }
                        }

                        //if (log.IsEnabled(LogLevel.Debug))
                        //{
                        //    log.LogDebug("async job acquisition thread woke up");
                        //}
                    }
                    catch (ThreadInterruptedException e)
                    {
                        if (log.IsEnabled(LogLevel.Debug))
                        {
                            log.LogDebug("async job acquisition wait interrupted");
                        }
                    }
                    finally
                    {
                        isWaiting = false;//.set(false);
                    }
                }
            }

            log.LogInformation("stopped async job due acquisition");
        }
Пример #7
0
        public virtual void tearDown()
        {
            ICommandExecutor commandExecutor = engineRule.ProcessEngineConfiguration.CommandExecutorTxRequired;

            commandExecutor.Execute(new CommandAnonymousInnerClass(this));
        }
Пример #8
0
 public void Dispatch(ICommand command)
 {
     executor.Execute(command);
 }
 public KeyGenerationDTO GetCode(string keyType)
 {
     return(_executor.Execute(new GetCodeDbCommandService(keyType)));
 }
Пример #10
0
 public async Task Delete(IEnumerable <DeleteElementRequest> requests)
 {
     await m_commandExecutor.Execute(new DeleteElementCommand { Requests = requests });
 }
        protected internal virtual void clearDatabase()
        {
            ICommandExecutor commandExecutor = processEngineConfiguration.CommandExecutorTxRequired;

            commandExecutor.Execute(new CommandAnonymousInnerClass(this));
        }
Пример #12
0
 public virtual TablePage ListPage(int firstResult, int maxResults)
 {
     this.firstResult = firstResult;
     this.maxResults  = maxResults;
     return(commandExecutor.Execute(this));
 }
        /// <summary>
        /// Updates the <see cref="ManifestDigest"/> in an <see cref="Implementation"/>.
        /// </summary>
        /// <param name="implementation">The <see cref="Implementation"/> to update.</param>
        /// <param name="path">The path of the directory to generate the digest for.</param>
        /// <param name="handler">A callback object used when the the user is to be informed about progress.</param>
        /// <param name="executor">Used to apply properties in an undoable fashion.</param>
        /// <param name="keepDownloads"><see langword="true"/> to store the directory as an implementation in the default <see cref="IStore"/>.</param>
        /// <exception cref="OperationCanceledException">The user canceled the task.</exception>
        /// <exception cref="IOException">There is a problem access a temporary file.</exception>
        /// <exception cref="UnauthorizedAccessException">Read or write access to a temporary file is not permitted.</exception>
        /// <exception cref="DigestMismatchException">An existing digest does not match the newly calculated one.</exception>
        private static void UpdateDigest([NotNull] this Implementation implementation, [NotNull] string path, [NotNull] ITaskHandler handler, ICommandExecutor executor, bool keepDownloads = false)
        {
            var digest = GenerateDigest(path, handler, keepDownloads);

            if (implementation.ManifestDigest == default(ManifestDigest))
                executor.Execute(new SetValueCommand<ManifestDigest>(() => implementation.ManifestDigest, value => implementation.ManifestDigest = value, digest));
            else if (!digest.PartialEquals(implementation.ManifestDigest))
                throw new DigestMismatchException(implementation.ManifestDigest.ToString(), digest.ToString());
        }
        private static void ConvertSha256ToSha256New(Implementation implementation, ICommandExecutor executor)
        {
            if (string.IsNullOrEmpty(implementation.ManifestDigest.Sha256) || !string.IsNullOrEmpty(implementation.ManifestDigest.Sha256New)) return;

            var digest = new ManifestDigest(
                implementation.ManifestDigest.Sha1,
                implementation.ManifestDigest.Sha1New,
                implementation.ManifestDigest.Sha256,
                implementation.ManifestDigest.Sha256.Base16Decode().Base32Encode());

            executor.Execute(new SetValueCommand<ManifestDigest>(() => implementation.ManifestDigest, value => implementation.ManifestDigest = value, digest));
        }
Пример #15
0
 public virtual IList <IIntegrationContextEntity> findIntegrationContextByExecutionId(string executionId)
 {
     return(commandExecutor.Execute(new RetrieveIntegrationContextsCmd(executionId)));
 }
Пример #16
0
 protected internal virtual void UnlockJob(string nextJobId, ICommandExecutor commandExecutor)
 {
     commandExecutor.Execute(new UnlockJobCmd(nextJobId));
 }
        public JobStatus Run(GetEmployeeCriteria criteria)
        {
            try
            {
                var hyperFindQuery = new HyperFindQuery
                {
                    HyperFindQueryName = "All Home",
                    VisibilityCode     = "Public",
                    QueryDateStart     = DateTime.Now,
                    QueryDateEnd       = DateTime.Now
                };

                _statusTracker.ShowInitialStep(JobStepDescription.GetEmployeeNumbers);
                _logger.Info(JobStepDescription.GetEmployeeNumbers);
                var fullPersonNumbersData =
                    _commandExecutor.Execute <HyperFindQuery, List <HyperFindResult> >(hyperFindQuery);

                // if EmployeesCount is a number employees person numbers we want to get
                // if EmployeesCount is 0 - all employees
                var personNumbers = criteria.EmployeesCount == 0
                    ? fullPersonNumbersData
                    : fullPersonNumbersData.Take(criteria.EmployeesCount).ToList();

                List <Employee> fullEmployeesData = new List <Employee>();

                // read full employee data passing a portion of pers numbers
                int portion = criteria.EmployeesPerPageNumber == default(int)
                    ? DefaultEmployeesPerPageNumber
                    : criteria.EmployeesPerPageNumber;

                int pageCount  = Convert.ToInt32(Math.Ceiling((double)personNumbers.Count / portion));
                var stepsCount = pageCount + 7;
                _statusTracker.Initialize(stepsCount);

                for (int i = 0; i < pageCount; i++)
                {
                    string stepDescription;
                    if (i == 0)
                    {
                        stepDescription = string.Format(JobStepDescription.GetFirstBunchOfFullEmployeeData, criteria.EmployeesCount < portion ? criteria.EmployeesCount : portion);
                    }
                    else
                    {
                        stepDescription = string.Format(JobStepDescription.GetNextBunchOfFullEmployeeData, portion);
                    }

                    _statusTracker.NotifyNewStep(stepDescription);
                    _logger.Info(stepDescription);
                    var personNumberPortion = personNumbers.Skip(i * portion).Take(portion).ToList();
                    var employeesPortion    =
                        _commandExecutor.Execute <List <HyperFindResult>, List <Employee> >(personNumberPortion);

                    fullEmployeesData.AddRange(employeesPortion);
                }

                _statusTracker.NotifyNewStep(string.Format(JobStepDescription.ExportFile, EmployeeListFileName));
                _logger.Info(string.Format(JobStepDescription.ExportFile, EmployeeListFileName));
                EmployeeListStep(fullEmployeesData, criteria.ShowWage, EmployeeListFileName);

                _statusTracker.NotifyNewStep(string.Format(JobStepDescription.ExportFile, EmployeeListLicenseFileName));
                EmployeeLicenseStep(fullEmployeesData, EmployeeListLicenseFileName);

                _statusTracker.NotifyNewStep(string.Format(JobStepDescription.ExportFile, EmployeeListCustomFields));
                EmployeeCustomFieldStep(fullEmployeesData, EmployeeListCustomFields);

                _statusTracker.NotifyNewStep(string.Format(JobStepDescription.ExportFile, EmployeeListCustomDateFileName));
                EmployeeCustomDateStep(fullEmployeesData, EmployeeListCustomDateFileName);

                EmployeePayRuleStep(fullEmployeesData);

                return(JobStatus.Success);
            }
            catch (FileNotAccessibleException ex)
            {
                _logger.Error(ex, GetType().Name);
                throw ex;
            }
            catch (Exception ex)
            {
                _logger.Error(ex, GetType().Name);
                return(JobStatus.Failed);
            }
        }
Пример #18
0
 private void OnExecute(ICommandExecutor commandExecutor)
 {
     commandExecutor.Execute(Rabbitmq.RemoveScripts);
 }
Пример #19
0
 public Task <TResult> ExecuteCommandAsync <TResult>(ICommand <TResult> command)
 {
     return(_commandExecutor.Execute(command));
 }
Пример #20
0
 public SearchResult <SliderDTO> Search(SliderSearchCriteria searchCriteria, int pageSize, int pageIndex)
 {
     return(_executor.Execute(new GetSliderDTOBySearchCriteriaDbCommand(searchCriteria, pageIndex, pageSize)));
 }
Пример #21
0
 public void Execute(params ICommand[] commands)
 {
     _commandExecutor.Execute(commands);
 }
Пример #22
0
        public virtual int Execute(TRequest input)
        {
            _command.BuildQuery(BuildParameter(input));

            return(_executor.Execute(_command));
        }
Пример #23
0
 private void OnExecute(ICommandExecutor commandExecutor)
 {
     commandExecutor.Execute(Mongodb.RemoveScripts);
 }
Пример #24
0
 public async Task Prepare(bool createNoWindow = true)
 {
     await Context.Dispatcher.InvokeAsync(async() =>
     {
         await _executor.Execute(new Command("adb devices"), Context, createNoWindow);
     });
 }
 public SearchResult <ExchangeRateDTO> Search(ExchangeRateSearchCriteria searchCriteria, int pageSize, int pageIndex)
 {
     return(_executor.Execute(new GetExchangeRateDTOBySearchCriteriaDbCommand(searchCriteria, pageIndex, pageSize)));
 }
Пример #26
0
        public async Task <IActionResult> Register([FromBody] RegisterCustomerCommand command)
        {
            await commandExecutor.Execute(command);

            return(View());
        }
Пример #27
0
 private void OnExecute(ICommandExecutor commandExecutor)
 {
     commandExecutor.Execute(AliyunYum.Scripts);
 }
Пример #28
0
 /// <summary>
 /// Gets the component value.
 /// </summary>
 /// <returns>The component value.</returns>
 public string GetValue()
 {
     return(_commandExecutor.Execute(_command));
 }
Пример #29
0
 public TResponse Execute(ICommandExecutor executor)
 {
     return(GetResponseFromResponseText(executor.Execute(this)));
 }
Пример #30
0
 public CommandResult Execute()
 {
     return(_executor.Execute(_spec, StartInfo, ExpectFailure));
 }
Пример #31
0
        public void 读取信号边界事件处理(string bpmnFile)
        {
            string xml = IntegrationTestContext.ReadBpmn(bpmnFile);

            ICommandExecutor commandExecutor = (processEngine.ProcessEngineConfiguration as ProcessEngineConfigurationImpl).CommandExecutor;

            Authentication.AuthenticatedUser = new InProcessWorkflowEngine.TestUser()
            {
                Id       = "评审员",
                FullName = "评审员",
                TenantId = context.TenantId
            };

            IDeploymentBuilder builder = processEngine.RepositoryService.CreateDeployment()
                                         .Name(Path.GetFileNameWithoutExtension(bpmnFile))
                                         .TenantId(context.TenantId)
                                         .AddString(bpmnFile, xml)
                                         .EnableDuplicateFiltering()
                                         .TenantId(context.TenantId);

            IDeployment deploy = commandExecutor.Execute(new DeployCmd(builder));

            IProcessDefinition definition = processEngine.RepositoryService.CreateProcessDefinitionQuery()
                                            .SetDeploymentId(deploy.Id)
                                            .SetProcessDefinitionTenantId(context.TenantId)
                                            .SetLatestVersion()
                                            .SingleResult();

            IProcessInstance processInstance = commandExecutor.Execute(new StartProcessInstanceCmd(definition.Id, null));

            IList <ITask> tasks = processEngine.TaskService.GetMyTasks("用户1");

            ITaskEntity      task      = tasks[0] as ITaskEntity;
            IExecutionEntity execution = commandExecutor.Execute(new GetExecutionByIdCmd(task.ExecutionId));

            //Process process = (processEngine.ProcessEngineConfiguration as ProcessEngineConfigurationImpl).DeploymentManager.ResolveProcessDefinition(definition).Process;
            //FlowElement activity = process.GetFlowElement(execution.CurrentActivityId, true);
            //string taskName = task.Name;

            //commandExecutor.Execute(new TerminateTaskCmd(task.Id, "测试终止", true));

            processEngine.TaskService.Complete(task.Id, new Dictionary <string, object>
            {
                { "流程变量", "变量值" }
            });

            tasks = processEngine.TaskService.GetMyTasks("用户2");
            task  = tasks[0] as ITaskEntity;
            processEngine.TaskService.Complete(task.Id, new Dictionary <string, object>
            {
                { "流程变量", "变量值" }
            });

            var list = commandExecutor.Execute(new GetCompletedTaskModelsCmd(task.ProcessInstanceId, true));

            //commandExecutor.Execute(new ReturnToActivityCmd(task.Id, execution.CurrentActivityId, "回退到", null));

            //task = tasks[0] as ITaskEntity;
            //execution = commandExecutor.Execute(new GetExecutionByIdCmd(task.ExecutionId));

            //commandExecutor.Execute(new TerminateProcessInstanceCmd(processInstance.Id, "流程已被取消", null));

            //IProcessInstance activityInstance = (processEngine.ProcessEngineConfiguration as ProcessEngineConfigurationImpl).CommandExecutor.Execute(new StartProcessInstanceByActivityCmd(definition.Id, execution.BusinessKey, activity.Id, null, execution.TenantId, null, true, execution.Name));

            //try
            //{
            //    //var events = processEngine.RuntimeService.CreateExecutionQuery()
            //    //    .SetParentId(tasks[0].ExecutionId)
            //    //    .SignalEventSubscriptionName("自动回退")
            //    //    .List();

            //    int count = 0;
            //    while (count < 3)
            //    {
            //        processEngine.ManagementService.ExecuteCommand(new SignalEventReceivedCmd("自动回退", null, false, context.TenantId));
            //        count += 1;
            //    }
            //}
            //catch { }
        }
Пример #32
0
 private void OnExecute(ICommandExecutor commandExecutor)
 {
     commandExecutor.Execute(Docker.InstallScripts);
 }
Пример #33
0
        /// <summary>
        ///
        /// </summary>
        public virtual void Run()
        {
            log.LogInformation("starting to acquire async jobs due");
            Thread.CurrentThread.Name = "activiti-acquire-timer-jobs";

            ICommandExecutor commandExecutor = asyncExecutor.ProcessEngineConfiguration.CommandExecutor;

            while (!isInterrupted)
            {
                try
                {
                    AcquiredTimerJobEntities acquiredJobs = commandExecutor.Execute(new AcquireTimerJobsCmd(asyncExecutor));

                    if (!(acquiredJobs is null))
                    {
                        commandExecutor.Execute(new CommandAnonymousInnerClass(this, acquiredJobs));

                        // if all jobs were executed
                        millisToWait = asyncExecutor.DefaultTimerJobAcquireWaitTimeInMillis;
                        int jobsAcquired = acquiredJobs.Size();
                        if (jobsAcquired >= asyncExecutor.MaxTimerJobsPerAcquisition)
                        {
                            millisToWait = 0;
                        }
                    }
                }
                catch (ActivitiOptimisticLockingException optimisticLockingException)
                {
                    if (log.IsEnabled(LogLevel.Debug))
                    {
                        log.LogDebug($@"Optimistic locking exception during timer job acquisition. 
If you have multiple timer executors running against the same database, 
this exception means that this thread tried to acquire a timer job, 
which already was acquired by another timer executor acquisition thread. 
This is expected behavior in a clustered environment. 
You can ignore this message if you indeed have multiple timer executor acquisition threads running against the same database. 
Exception message: {optimisticLockingException.Message}");
                    }
                }
                catch (ObjectDisposedException ex)
                {
                    if (log.IsEnabled(LogLevel.Debug))
                    {
                        log.LogDebug($@"Optimistic locking exception during timer job acquisition. 
If you have multiple timer executors running against the same database, 
this exception means that this thread tried to acquire a timer job, 
which already was acquired by another timer executor acquisition thread. 
This is expected behavior in a clustered environment. 
You can ignore this message if you indeed have multiple timer executor acquisition threads running against the same database. 
Exception message: {ex.Message}");
                    }
                }
                catch (Exception e)
                {
                    log.LogError($"exception during timer job acquisition: {e.Message}");
                    millisToWait = asyncExecutor.DefaultTimerJobAcquireWaitTimeInMillis;
                }

                if (millisToWait > 0)
                {
                    try
                    {
                        if (log.IsEnabled(LogLevel.Debug))
                        {
                            log.LogDebug($"timer job acquisition thread sleeping for {millisToWait} millis");
                        }
                        lock (MONITOR)
                        {
                            if (!isInterrupted)
                            {
                                isWaiting = true;
                                Monitor.Wait(MONITOR, TimeSpan.FromMilliseconds(millisToWait));
                            }
                        }

                        if (log.IsEnabled(LogLevel.Debug))
                        {
                            log.LogDebug("timer job acquisition thread woke up");
                        }
                    }
                    catch (Exception e)
                    {
                        if (log.IsEnabled(LogLevel.Debug))
                        {
                            log.LogDebug("timer job acquisition wait interrupted");
                        }
                    }
                    finally
                    {
                        isWaiting = false;
                    }
                }
            }

            log.LogInformation("stopped async job due acquisition");
        }
Пример #34
0
        /// <summary>
        /// Executes the command within a transaction. The transaction logic uses TransactionScope.
        /// </summary>
        /// <param name="command">The command to execute. This should not be null.</param>
        /// <exception cref="ArgumentNullException">Occurs when <i>command</i> is null.</exception>
        public void Execute(TCommand command)
        {
            var transactionService = NcqrsEnvironment.Get <ITransactionService>();

            transactionService.ExecuteInTransaction(() => _executor.Execute(command));
        }