コード例 #1
0
        public async Task LaunchModule(IOperation operation, int moduleId)
        {
            if (!await moduleStore.IsModuleExists(operation, moduleId))
            {
                throw CommonExceptions.ModuleWasNotFound(operation, moduleId);
            }

            if (!(await moduleStore.HasStatuses(operation, moduleId, ModuleStatus.Stopped, ModuleStatus.FailedToRun)).Any())
            {
                throw CommonExceptions.FailedToRunModule(operation);
            }

            await moduleStore.ChangeStatus(operation, moduleId, ModuleStatus.UpdatedToRun);

            await new ProcessDefinition.StartProcessInstanceByKeyRequest(CamundaWorkerKey.ModuleLaunchProcess)
            {
                BusinessKey = moduleId.ToString(),
                Variables   = new CamundaVariables
                {
                    { CamundaWorkerKey.ModuleId, moduleId },
                    { CamundaWorkerKey.Action, ActionType.NoChanges }
                }
            }.SendRequest(operation, camundaClient, true);
        }