first, the implementation of the listener
1. Create Listening
/**
* Execute listener
* Created by Administrator on 2017/10/12.
*
/public class Myexecutionlistener implements Executionlistener {
@Override public
void Notify ( Delegateexecution execution) {
System.out.println ("notify====geteventname=====" + execution.geteventname ());
}
}
2, create the process:
3. Add the monitor at the start point
4. Generate three Files
5. Deployment process
@Test public
void Deployleave () throws Exception {
Deploymentbuilder builder = Processengine.getrepositoryservice (). Createdeployment ();
Builder.addclasspathresource ("FLOW/EXECUTIONLISTENER.BPMN");
Builder.addclasspathresource ("Flow/executionlistener.png");
Builder.name ("Perform listener reimbursement Process Deployment");
Deployment deploy = Builder.deploy ();
System.out.println ("deploy.getid () = =" + Deploy.getid ());
}
6, when starting process instances, add variables
@Test public
void Startprocessinstancebykey () throws Exception {
//string processdefinitionkey = "Grouptask"; C2/>string Processinstanceid = "72501";
map<string, object> variable = new hashmap<string, object> ();
Variable.put ("Amount", "300 Yuan");
Variable.put ("Reason", "travel");
ProcessInstance processinstance = Processengine.getruntimeservice (). Startprocessinstancebyid (ProcessInstanceId, variable);
System.out.println ("processinstance.getid () = =" + Processinstance.getid ());
System.out.println ("processinstance.getprocessdefinitionid () = =" + Processinstance.getprocessdefinitionid ());
}
7. Complete the task
@Test public
void Dealpersonaltask () throws Exception {
String taskId = "75011";
Processengine.gettaskservice (). complete (taskId);
Note: When submitting a task and completing a task, a listener event will be triggered.
1, create the Listener
public class MyTaskListener1 implements Tasklistener {
@Override public
void Notify (Delegatetask delegatetask) {
System.out.println (Delegatetask.getexecutionid ());
map<string, object> variables = delegatetask.getvariables ();
set<string> variablenames = Delegatetask.getvariablenames ();
for (String key:variablenames) {
System.out.println (key + ":" + delegatetask.getvariable (key));
}
SYSTEM.OUT.PRINTLN ("a task by" + delegatetask.getname () + "created, next step by" + delegatetask.getassignee () + "responsible for processing");
}
2. Add Create Listener
————————————————————————————————————————————————— – Java Architect Project Combat, high concurrency cluster distributed, large data high availability video tutorials, total 760G
Download Address:
https://item.taobao.com/item.htm?id=555888526201
01. High-level architect 42 Phases
02.Java Advanced System Training Architecture Course 148 hours
03.Java Senior Internet Architect Course
04.Java Internet Architecture Netty, Nio, Mina, etc.-Video tutorials
05.Java Advanced Architecture Design 2016 finishing-video tutorials
06. Architect Foundation, advanced film
07.Java Architect Required Linux Operation series courses
08.Java Advanced System Training Architecture Course 116 hours
+
Hadoop series tutorials, Java design patterns and data structures, Spring Cloud Micro service, Springboot Primer
—————————————————————————————————————————————————–