• notice
  • Congratulations on the launch of the Sought Tech site

Fourth, BPMN simple use and Activiti process deployment, start instance

One, use actiBPM to create a process

1.1 Process id setting

Click the blank space to set the process id

2.2 Set task assignee

The assignees of each task are as follows

Second, deployment process

 //1.Create ProcessEngine
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        //2.Get RepositoryService
        RepositoryService repositoryService = processEngine.getRepositoryService();
        //2.Use RepositoryService for process deployment and define a process name
        //Deploy bmpn and png to the data
        Deployment deployment = repositoryService.createDeployment()
              .name("Business Travel Application")
                //.addClasspathResource("bpmn/evection.png") //no need to write

        System.out.println("Process deployment id:"+deployment.getId());
        System.out.println("Process deployment name:"+deployment.getName());

Control console printing

Process deployment id: 5001
Process deployment name: business travel application

Three, start process instance

 ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        RuntimeService runtimeService = processEngine.getRuntimeService();
        //Start the process according to the id defined by the process
        //The bykey here is because although the name is id in the bpmn file, the field actually stored in the database is key_
        ProcessInstance instance = runtimeService.startProcessInstanceByKey("myevection");

        System.out.println("Process Definition ID"+instance.getProcessDefinitionId());
        System.out.println("Process instance ID"+instance.getId());
        System.out.println("Current Activity ID"+instance.getActivityId());

Control console printing

Process definition IDmyevection:1:5003
Process instance ID7501
ID of the current activitynull



Technical otaku

Sought technology together

Related Topic


Leave a Reply