Example #1
0
    // customized handler
    public void execute(ExternalTask task, ExternalTaskService externalTaskService)
    {
        // complete external task
        externalTaskService.complete(task);

        Console.WriteLine("External Task " + task + " successfully completed!\n");
    }
Example #2
0
        protected internal virtual UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto)
        {
            ExternalTaskService externalTaskService = ProcessEngine.ExternalTaskService;

            IList <string> externalTaskIds    = retriesDto.ExternalTaskIds;
            IList <string> processInstanceIds = retriesDto.ProcessInstanceIds;

            ExternalTaskQuery            externalTaskQuery            = null;
            ProcessInstanceQuery         processInstanceQuery         = null;
            HistoricProcessInstanceQuery historicProcessInstanceQuery = null;

            ExternalTaskQueryDto externalTaskQueryDto = retriesDto.ExternalTaskQuery;

            if (externalTaskQueryDto != null)
            {
                externalTaskQuery = externalTaskQueryDto.toQuery(ProcessEngine);
            }

            ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.ProcessInstanceQuery;

            if (processInstanceQueryDto != null)
            {
                processInstanceQuery = processInstanceQueryDto.toQuery(ProcessEngine);
            }

            HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.HistoricProcessInstanceQuery;

            if (historicProcessInstanceQueryDto != null)
            {
                historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(ProcessEngine);
            }

            return(externalTaskService.updateRetries().externalTaskIds(externalTaskIds).processInstanceIds(processInstanceIds).externalTaskQuery(externalTaskQuery).processInstanceQuery(processInstanceQuery).historicProcessInstanceQuery(historicProcessInstanceQuery));
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void initServices()
        public virtual void initServices()
        {
            runtimeService      = engineRule.RuntimeService;
            externalTaskService = engineRule.ExternalTaskService;
            managementService   = engineRule.ManagementService;
            historyService      = engineRule.HistoryService;
        }
Example #4
0
        public ProcessEngineImpl(ProcessEngineConfigurationImpl processEngineConfiguration)
        {
            this.processEngineConfiguration = processEngineConfiguration;
            this.name = processEngineConfiguration.ProcessEngineName;

            this.repositoryService    = processEngineConfiguration.RepositoryService;
            this.runtimeService       = processEngineConfiguration.RuntimeService;
            this.historicDataService  = processEngineConfiguration.HistoryService;
            this.identityService      = processEngineConfiguration.IdentityService;
            this.taskService          = processEngineConfiguration.TaskService;
            this.formService          = processEngineConfiguration.FormService;
            this.managementService    = processEngineConfiguration.ManagementService;
            this.authorizationService = processEngineConfiguration.AuthorizationService;
            this.caseService          = processEngineConfiguration.CaseService;
            this.filterService        = processEngineConfiguration.FilterService;
            this.externalTaskService  = processEngineConfiguration.ExternalTaskService;
            this.decisionService      = processEngineConfiguration.DecisionService;

            this.databaseSchemaUpdate       = processEngineConfiguration.DatabaseSchemaUpdate;
            this.jobExecutor                = processEngineConfiguration.JobExecutor;
            this.commandExecutor            = processEngineConfiguration.CommandExecutorTxRequired;
            commandExecutorSchemaOperations = processEngineConfiguration.CommandExecutorSchemaOperations;
            this.sessionFactories           = processEngineConfiguration.SessionFactories;
            this.historyLevel               = processEngineConfiguration.HistoryLevel;
            this.transactionContextFactory  = processEngineConfiguration.TransactionContextFactory;

            executeSchemaOperations();

            if (string.ReferenceEquals(name, null))
            {
                LOG.processEngineCreated(ProcessEngines.NAME_DEFAULT);
            }
            else
            {
                LOG.processEngineCreated(name);
            }

            ProcessEngines.registerProcessEngine(this);

            if ((jobExecutor != null))
            {
                // register process engine with Job Executor
                jobExecutor.registerProcessEngine(this);
            }

            if (processEngineConfiguration.MetricsEnabled)
            {
                string            reporterId        = processEngineConfiguration.MetricsReporterIdProvider.provideId(this);
                DbMetricsReporter dbMetricsReporter = processEngineConfiguration.DbMetricsReporter;
                dbMetricsReporter.ReporterId = reporterId;

                if (processEngineConfiguration.DbMetricsReporterActivate)
                {
                    dbMetricsReporter.start();
                }
            }
        }
Example #5
0
 public ExternalTaskTopicManager(string workerId, ExternalTaskService externalTaskService,
                                 ExternalTaskTopicManagerInfo taskManagerInfo, IBackoffStrategy backoffStrategy, IPolicyManager policyManager)
 {
     this.workerId            = workerId;
     this.externalTaskService = externalTaskService;
     this.topicManagerInfo    = taskManagerInfo;
     this.backoffStrategy     = backoffStrategy;
     this.policyManager       = policyManager;
 }
Example #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void initServices()
        public virtual void initServices()
        {
            configuration       = engineRule.ProcessEngineConfiguration;
            runtimeService      = engineRule.RuntimeService;
            managementService   = engineRule.ManagementService;
            taskService         = engineRule.TaskService;
            historyService      = engineRule.HistoryService;
            externalTaskService = engineRule.ExternalTaskService;
        }
 public ExternalTaskWorker(ExternalTaskService service, IExternalTaskAdapter adapter, String topicName, int retries, long retryTimeout, String[] variablesToFetch)
 {
     this.adapter          = adapter;
     this.topicName        = topicName;
     this.variablesToFetch = variablesToFetch;
     this.service          = service;
     this.retries          = retries;
     this.retryTimeout     = retryTimeout;
 }
Example #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void setUp()
        {
            runtimeService      = engineRule.RuntimeService;
            repositoryService   = engineRule.RepositoryService;
            historyService      = engineRule.HistoryService;
            managementService   = engineRule.ManagementService;
            taskService         = engineRule.TaskService;
            externalTaskService = engineRule.ExternalTaskService;
            identityService     = engineRule.IdentityService;
        }
Example #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void init()
        public virtual void init()
        {
            externalTaskService = engineRule.ExternalTaskService;

            taskService = engineRule.TaskService;

            identityService = engineRule.IdentityService;

            testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/externaltask/twoExternalTaskProcess.bpmn20.xml");

            processInstanceId = engineRule.RuntimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY).Id;
        }
Example #10
0
        public virtual void unlock()
        {
            ExternalTaskService externalTaskService = engine.ExternalTaskService;

            try
            {
                externalTaskService.unlock(externalTaskId);
            }
            catch (NotFoundException e)
            {
                throw new RestException(Status.NOT_FOUND, e, "External task with id " + externalTaskId + " does not exist");
            }
        }
Example #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void init()
        public virtual void init()
        {
            runtimeService      = engineRule.RuntimeService;
            formService         = engineRule.FormService;
            historyService      = engineRule.HistoryService;
            taskService         = engineRule.TaskService;
            managementService   = engineRule.ManagementService;
            repositoryService   = engineRule.RepositoryService;
            identityService     = engineRule.IdentityService;
            externalTaskService = engineRule.ExternalTaskService;
            decisionService     = engineRule.DecisionService;

            processEngineConfiguration = engineRule.ProcessEngineConfiguration;
        }
Example #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void setUp()
        {
            repositoryService   = engineRule.RepositoryService;
            historyService      = engineRule.HistoryService;
            runtimeService      = engineRule.RuntimeService;
            identityService     = engineRule.IdentityService;
            externalTaskService = engineRule.ExternalTaskService;

            testRule.deployForTenant(TENANT_ONE, ONE_EXTERNAL_TASK_PROCESS);
            testRule.deployForTenant(TENANT_TWO, ONE_EXTERNAL_TASK_PROCESS);

            startProcessInstanceAndFailExternalTask(TENANT_ONE);
            startProcessInstanceFailAndCompleteExternalTask(TENANT_TWO);
        }
Example #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpRuntimeData()
        public virtual void setUpRuntimeData()
        {
            namedProcessEngine      = getProcessEngine(EXAMPLE_ENGINE_NAME);
            mockRepoService         = mock(typeof(RepositoryService));
            mockRuntimeService      = mock(typeof(RuntimeService));
            mockTaskService         = mock(typeof(TaskService));
            mockIdentityService     = mock(typeof(IdentityService));
            mockManagementService   = mock(typeof(ManagementService));
            mockHistoryService      = mock(typeof(HistoryService));
            mockCaseService         = mock(typeof(CaseService));
            mockFilterService       = mock(typeof(FilterService));
            mockExternalTaskService = mock(typeof(ExternalTaskService));

            when(namedProcessEngine.RepositoryService).thenReturn(mockRepoService);
            when(namedProcessEngine.RuntimeService).thenReturn(mockRuntimeService);
            when(namedProcessEngine.TaskService).thenReturn(mockTaskService);
            when(namedProcessEngine.IdentityService).thenReturn(mockIdentityService);
            when(namedProcessEngine.ManagementService).thenReturn(mockManagementService);
            when(namedProcessEngine.HistoryService).thenReturn(mockHistoryService);
            when(namedProcessEngine.CaseService).thenReturn(mockCaseService);
            when(namedProcessEngine.FilterService).thenReturn(mockFilterService);
            when(namedProcessEngine.ExternalTaskService).thenReturn(mockExternalTaskService);

            createProcessDefinitionMock();
            createProcessInstanceMock();
            createTaskMock();
            createIdentityMocks();
            createExecutionMock();
            createVariableInstanceMock();
            createJobDefinitionMock();
            createIncidentMock();
            createDeploymentMock();
            createMessageCorrelationBuilderMock();
            createCaseDefinitionMock();
            createCaseInstanceMock();
            createCaseExecutionMock();
            createFilterMock();
            createExternalTaskMock();

            createHistoricActivityInstanceMock();
            createHistoricProcessInstanceMock();
            createHistoricVariableInstanceMock();
            createHistoricActivityStatisticsMock();
            createHistoricDetailMock();
            createHistoricTaskInstanceMock();
            createHistoricIncidentMock();
            createHistoricJobLogMock();
            createHistoricExternalTaskLogMock();
        }
Example #14
0
 protected internal virtual void clearServiceReferences()
 {
     processEngineConfiguration = null;
     repositoryService          = null;
     runtimeService             = null;
     taskService          = null;
     formService          = null;
     historyService       = null;
     identityService      = null;
     managementService    = null;
     authorizationService = null;
     caseService          = null;
     filterService        = null;
     externalTaskService  = null;
     decisionService      = null;
 }
Example #15
0
 protected internal virtual void initializeServices()
 {
     processEngineConfiguration = ((ProcessEngineImpl)processEngine).ProcessEngineConfiguration;
     repositoryService          = processEngine.RepositoryService;
     runtimeService             = processEngine.RuntimeService;
     taskService          = processEngine.TaskService;
     formService          = processEngine.FormService;
     historyService       = processEngine.HistoryService;
     identityService      = processEngine.IdentityService;
     managementService    = processEngine.ManagementService;
     authorizationService = processEngine.AuthorizationService;
     caseService          = processEngine.CaseService;
     filterService        = processEngine.FilterService;
     externalTaskService  = processEngine.ExternalTaskService;
     decisionService      = processEngine.DecisionService;
 }
Example #16
0
        public virtual void handleFailure(ExternalTaskFailureDto dto)
        {
            ExternalTaskService externalTaskService = engine.ExternalTaskService;

            try
            {
                externalTaskService.handleFailure(externalTaskId, dto.WorkerId, dto.ErrorMessage, dto.ErrorDetails, dto.Retries, dto.RetryTimeout);
            }
            catch (NotFoundException e)
            {
                throw new RestException(Status.NOT_FOUND, e, "External task with id " + externalTaskId + " does not exist");
            }
            catch (BadUserRequestException e)
            {
                throw new RestException(Status.BAD_REQUEST, e, e.Message);
            }
        }
Example #17
0
        public virtual void handleBpmnError(ExternalTaskBpmnError dto)
        {
            ExternalTaskService externalTaskService = engine.ExternalTaskService;

            try
            {
                externalTaskService.handleBpmnError(externalTaskId, dto.WorkerId, dto.ErrorCode, dto.ErrorMessage, VariableValueDto.toMap(dto.Variables, engine, objectMapper));
            }
            catch (NotFoundException e)
            {
                throw new RestException(Status.NOT_FOUND, e, "External task with id " + externalTaskId + " does not exist");
            }
            catch (BadUserRequestException e)
            {
                throw new RestException(Status.BAD_REQUEST, e, e.Message);
            }
        }
Example #18
0
        public virtual void extendLock(ExtendLockOnExternalTaskDto extendLockDto)
        {
            ExternalTaskService externalTaskService = engine.ExternalTaskService;

            try
            {
                externalTaskService.extendLock(externalTaskId, extendLockDto.WorkerId, extendLockDto.NewDuration);
            }
            catch (NotFoundException e)
            {
                throw new RestException(Status.NOT_FOUND, e, "External task with id " + externalTaskId + " does not exist");
            }
            catch (BadUserRequestException e)
            {
                throw new RestException(Status.BAD_REQUEST, e, e.Message);
            }
        }
Example #19
0
        public virtual void complete(CompleteExternalTaskDto dto)
        {
            ExternalTaskService externalTaskService = engine.ExternalTaskService;

            VariableMap variables      = VariableValueDto.toMap(dto.Variables, engine, objectMapper);
            VariableMap localVariables = VariableValueDto.toMap(dto.LocalVariables, engine, objectMapper);

            try
            {
                externalTaskService.complete(externalTaskId, dto.WorkerId, variables, localVariables);
            }
            catch (NotFoundException e)
            {
                throw new RestException(Status.NOT_FOUND, e, "External task with id " + externalTaskId + " does not exist");
            }
            catch (BadUserRequestException e)
            {
                throw new RestException(Status.BAD_REQUEST, e, e.Message);
            }
        }
Example #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @After public void tearDownCdiProcessEngineTestCase() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void tearDownCdiProcessEngineTestCase()
        {
            org.camunda.bpm.container.RuntimeContainerDelegate_Fields.INSTANCE.get().unregisterProcessEngine(processEngine);
            beanManager   = null;
            processEngine = null;
            processEngineConfiguration = null;
            formService          = null;
            historyService       = null;
            identityService      = null;
            managementService    = null;
            repositoryService    = null;
            runtimeService       = null;
            taskService          = null;
            authorizationService = null;
            filterService        = null;
            externalTaskService  = null;
            caseService          = null;
            decisionService      = null;
            processEngineRule    = null;
        }
Example #21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpCdiProcessEngineTestCase() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void setUpCdiProcessEngineTestCase()
        {
            if (BpmPlatform.ProcessEngineService.DefaultProcessEngine == null)
            {
                org.camunda.bpm.container.RuntimeContainerDelegate_Fields.INSTANCE.get().registerProcessEngine(processEngineRule.ProcessEngine);
            }

            beanManager   = ProgrammaticBeanLookup.lookup(typeof(BeanManager));
            processEngine = processEngineRule.ProcessEngine;
            processEngineConfiguration = (ProcessEngineConfigurationImpl)processEngineRule.ProcessEngine.ProcessEngineConfiguration;
            formService          = processEngine.FormService;
            historyService       = processEngine.HistoryService;
            identityService      = processEngine.IdentityService;
            managementService    = processEngine.ManagementService;
            repositoryService    = processEngine.RepositoryService;
            runtimeService       = processEngine.RuntimeService;
            taskService          = processEngine.TaskService;
            authorizationService = processEngine.AuthorizationService;
            filterService        = processEngine.FilterService;
            externalTaskService  = processEngine.ExternalTaskService;
            caseService          = processEngine.CaseService;
            decisionService      = processEngine.DecisionService;
        }
Example #22
0
        private void mockServices(ProcessEngine engine)
        {
            RepositoryService   repoService         = mock(typeof(RepositoryService));
            IdentityService     identityService     = mock(typeof(IdentityService));
            TaskService         taskService         = mock(typeof(TaskService));
            RuntimeService      runtimeService      = mock(typeof(RuntimeService));
            FormService         formService         = mock(typeof(FormService));
            HistoryService      historyService      = mock(typeof(HistoryService));
            ManagementService   managementService   = mock(typeof(ManagementService));
            CaseService         caseService         = mock(typeof(CaseService));
            FilterService       filterService       = mock(typeof(FilterService));
            ExternalTaskService externalTaskService = mock(typeof(ExternalTaskService));

            when(engine.RepositoryService).thenReturn(repoService);
            when(engine.IdentityService).thenReturn(identityService);
            when(engine.TaskService).thenReturn(taskService);
            when(engine.RuntimeService).thenReturn(runtimeService);
            when(engine.FormService).thenReturn(formService);
            when(engine.HistoryService).thenReturn(historyService);
            when(engine.ManagementService).thenReturn(managementService);
            when(engine.CaseService).thenReturn(caseService);
            when(engine.FilterService).thenReturn(filterService);
            when(engine.ExternalTaskService).thenReturn(externalTaskService);
        }
Example #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void setUp()
        {
            runtimeService      = engineRule.RuntimeService;
            historyService      = engineRule.HistoryService;
            externalTaskService = engineRule.ExternalTaskService;
        }
Example #24
0
 public ExternalTaskWorker(ExternalTaskService externalTaskService, ExternalTaskWorkerInfo taskWorkerInfo)
 {
     this.externalTaskService = externalTaskService;
     this.taskWorkerInfo      = taskWorkerInfo;
 }
Example #25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void initServices()
        public virtual void initServices()
        {
            runtimeService      = rule.RuntimeService;
            externalTaskService = rule.ExternalTaskService;
        }
Example #26
0
 public ExternalTaskTopicManager(string workerId, ExternalTaskService externalTaskService,
                                 ExternalTaskTopicManagerInfo taskManagerInfo)
     : this(workerId, externalTaskService, taskManagerInfo, new ExponentialBackoff(500, 2, 64000))
 {
 }
Example #27
0
 public ExternalTaskTopicManager(string workerId, ExternalTaskService externalTaskService,
                                 ExternalTaskTopicManagerInfo taskManagerInfo, IBackoffStrategy backoffStrategy)
     : this(workerId, externalTaskService, taskManagerInfo, backoffStrategy, new DefaultPolicyManager(backoffStrategy, taskManagerInfo.TopicName))
 {
 }