note

1027Currently online
115Today's Reading
17Share Today
Multilingual display

activity Event (2) Boundary timer event

2018-05-14 14:24:30

There are Message boundary events, Timer boundary events, Escalation boundary events, Error boundary events, Cancel boundary events, Compensation boundary events, Conditional boundary events. Boundary events, Signal boundary events, combined boundary events, and Parallel Multiple boundary events.

Tools/Materials
1

computer

2

intelliJ idea, jdk1.8, mysql

Methods/Steps
1

This article only talks about the timer boundary event, because the timer event has just finished, and it will be easier to understand the timer boundary event.

2

Description: Timer boundary events act as stopwatches and alarm clocks. A timer is started when an activity is executed that reaches an additional boundary event. When the timer is triggered (for example, after a specified interval), the activity is interrupted, following the boundary event.

3

Service scenario: applies to time-limited business processes.

4

The configuration flow file contains the following contents: flow chart below.

5

The test procedure is to create two process instances to compare whether the process path is task1- "task3" when instance 1 does not time out, and whether the process path is task1- "task2-" task3 when instance 2 times out. The Test code is as follows: @ Test public void exe () {RepositoryService RepositoryService = engine. GetRepositoryService (); / / deployment process file repositoryService. CreateDeployment ()  .addClasspathResource('processes/timerBoundary.bpmn').deploy();        engine.getProcessEngineConfiguration().getAsyncExecutor().start(); // Pay attention to this sentence Turn on the timer, Must add / / start a process ProcessInstance ProcessInstance. = runtimeService startProcessInstanceByKey (' Process_1 '); / / query first Task Task. = taskService createTaskQuery () processInstanceId (processInstance. GetId ()). SingleResult ();         System.out.println(' First instance, current node name '+ task.getName()); // Complete the first task taskService.complete(task.getid ()); task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();        System.out.println(' first instance, after the first task is completed: '+ task); / / end process taskService.com plete (task. GetId ()); // Start the second process instance, the first task is not executed, etc. After triggering the boundary timer event, look at the task node, And then perform the task node processInstance. = runtimeService startProcessInstanceByKey (' Process_1 '); task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();        System.out.println(' Second instance, current node name '+ task.getName()); / / timer over there are 20 seconds, side set the sleeping 30 seconds try {thread.sleep (1000 * 70); } catch (InterruptedException e) {           e.printStackTrace();        }       task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();        System.out.println(' Second instance, current node name after timeout '+ task.getName()); // Complete the first task taskService.complete(task.getid ()); task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();        System.out.println(' second instance, after task completion: '+ task); taskService.complete(task.getId()); // End process Taskservice.com plete(task.getid ()); } The result is: first instance, current node name User Task 1 First instance, after the first task is completed: Task[id=57509, name=User Task 3] Second instance, name of the current node User Task 1 Second instance, name of the current node after the timeout User Task 2 Second instance, after the task is completed: Task[id=57522, name=User Task 3] is the same as before the test.

Recommendation