Jbpm4.4: processdefinition/processinstance/execution/task relationship and Difference

Source: Internet
Author: User
Tags jbpm

Processdefinition:
It is better understood that the process definition is equivalent to a standard.

Processdefinition also has an ID, which is {key}-{version}

During deployment, an ID is assigned to the process definition. The ID is in the format of {key}-{version}. The key and version are connected by a hyphen.
If no key is provided, it is automatically generated based on the name. The generated key replaces all characters other than letters and numbers with underscores.

Processinstance:
This is an example of a process.

In the system, there is also a processinstance ID

Key can be used to create a process instance id in the format of {process-key}. {execution-ID }.
If the user-defined key is not provided, the database uses the primary key as the key.

In Java: processdefinition isCodeAnd processinstance is the new class, and an instance is created;

 

Execution: it is hard to understand.

This is what jbpm officially says:

The http://jboss.org/jbpm wrote
Each execution of a process definition is called a process instance.

The implementation of each process definition is a process instance. This only describes the relationship between processdefinition and processinstance.

 

In executionservice, start is processinstance.

In the javadoc of processinstance, the difference between processinstance and execution is described as follows:

Processinstance javadoc writes:
A process instance is one execution of a process definition. One process instance can have same concurrent executions. executions are structured in a tree of which the processinstance is the root.
 

A process instance is the execution of a processdefinition;

A process instance can have many concurrent steps (concurrent executions)

The execution steps constitute a structured tree with processintance (process instance) as the root node (Root)

 

In this document, the executionid and processid are described as follows:

The http://www.family168.com/tutorial/jbpm4.0/html/services.html wrote
Sometimes the execution ID is different from the process instance id. When a node uses a timer, the execution ID uses an additional suffix, this will cause the node to not appear in the result list when we query through execution ID.

 

The actual operation is as follows:

At the beginning, exectionid and processid were the same;
If only one step (whether a task can be said) is being processed at a time in the process, the exectionid and processid are the same,
However, when there are multiple tasks to be processed at the same time point, such as the above timer or the fork/join process, exectionid and processid are different at this time.
It can be understood that execution is the execution path. When several paths are being executed at the same time, executionid is different from processid.
Moreover, execution is the base class of processinstance.

The specific performance is

JAVA code
// get execution service
executionservice = processengine. getexecutionservice ();
// get current execution through processid
execution = executionservice. findexecutionbyid (processid);
// get a task query
taskquery TQ = taskservice. createtaskquery ();
// get current task
List tasklist1 = tq.exe cutionid (execution. GETID ()). list ();
List tasklist2 = TQ. processinstanceid (processid ). list ();

// Get execution service executionservice = processengine. getexecutionservice (); // get current execution through processid execution = executionservice. findexecutionbyid (processid); // get a task query taskquery TQ = taskservice. createtaskquery (); // get current task list <task> tasklist1 = tq.exe cutionid (execution. GETID ()). list (); List <task> tasklist2 = TQ. processinstanceid (processid ). list ();

The precedingProgramIn general, tasklist1 is the same as tasklist2.

However, when you enter the fork/join process, the executionid has been changed,

Tasklist1 cannot retrieve any task, and tasklist2 can retrieve the task.

 

 

Task:

The task is simple, that is, the work to be done.

Wrote in javadoc
A runtime task. In contrast to historytask, a task only represents the runtime state of a task and hence it will be deleted after it is completed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.