[PE] flowchart object and event-driven mechanism

Source: Internet
Author: User

This is the first developer document of the PE system. First, let's give a brief introduction to the PE! PE is a WF-based process engine for developers. It is still very small and has limited functions. Please forgive me. Currently, the PE version is 0.1, so please do not try to use it in commercial projects. The consequences are not complicated. Pai_^ the main task that PE can accomplish in the current version is to construct a process and run it. Although some of the functions can be released, I still want to wait for the PE to be released after it is stable. Sorry again for the simplicity of PE. Starting from this article, I will introduce the process elements supported by PE and give corresponding demos.CodePlease forgive us for any inaccuracy or ignorance. The basic process elements and attributes of PE are mainly referenced in Business Process Model notation (BPMN). If you are interested in this standard, you canWww.BPMN. Org/download the document.

(1) Flowchart
Since our primary goal is to create a process, we need a container to accommodate the process. This is the process diagram ). In PE, each flowchart can contain one or more processes. There is no flow chart in WF. I constructed the flow chart object myself:
Processdi#processdi#= new processdi#() {name = "firstdi "};
You can use the above code to create an ECS instance.
In PE, I also added the concept of swimming channels. flows are not directly placed in flowcharts, but in the pool. Their relationships are as follows:
Each process can contain one or more process pools, and each process pool can contain only one process.
Processdigoal. addpool (new pool ("firstpool "));
With the above code, you can create a process pool named firstpool and add it to the flowchart. You can add multiple process pools.
Note: The names of all process objects in the same flowchart in PE cannot be repeated. Otherwise, the cognominal objects are ignored.
In the addpool method, not only will the process pool object be added to the flowchart, but a businessprocessactivity object will also be created automatically. Its name is the same as that of the pool, and associated with the current process pool.
You can use the getbusinessprocpolicypoolname (string poolname) method in the flowchart to obtain the automatically created process object and modify its name.

Is the structure of the flowchart object. Most of the methods provide the add, delete, and query functions of the elements in the graph. I will introduce them in detail later.
(2) event-driven
After a flow chart and a process are established, it is critical to start the process. In PE, process initiation, execution, and termination are all driven by events. The events are divided into startevent, endevent, and intermediateevents Based on the trigger time ).
A start event is an event used to start a process. An end event is an action executed when the process ends. An intermediate event has two major functions: one is to continue the process, second, handle errors or cancel the compensation execution. Start events are divided into nonestartevent, linkstartevent, messagestartevent, timerstartevent, and multiplestartevent based on the reasons for triggering the process.
A. nonestartevent indicates that the process is triggered manually. Here, the manual is outside the process engine. Program For example, the code used by the engine.
B. linkstartevent indicates that the process is triggered by the linkendevent event of another process;
C. messagestartevent indicates that the process is triggered by messages sent by other processes;
D. timerstartevent indicates that the process is triggered by time;
E. multiplestartevent indicates that the process can be triggered for one of multiple reasons. That is, multiplestartevent can contain multiple of the above-mentioned start events. If one of them is triggered, multiplestartevent is triggered.
Processdiworkflow. getbusinessprocpolicypoolname ("firstpool"). addactivity (New nonestartevent () {name = "nonestartevent "});
The above Code adds a nonestartevent to the process named "firstpool.
The ending events are divided into noneendevent, terminateendevent, cancelendevent, compensationendevent, errorendevent, linkendevent, messageendevent, and multipleendevent according to the tasks executed at the end of the process.
A. noneendevent indicates that no code is executed at the end of the process and the process ends normally.
B. terminateendevent indicates that the process must terminate all activities here.
C. cancelendevent indicates that the process-related transactions will be canceled. If an intermediate event is canceled in the process, the execution of the cancellation activity will be triggered.
D. compensationendevent indicates that an extra compensation task must be executed at the end of the process. If a compensation intermediate event is set in the process, the execution of the compensation activity will be triggered.
E. errorendevent indicates that the process ends with an error. If an error intermediate event is set in the process, the execution of the error handling activity is triggered.
F. linkendevent indicates that another process starts when the process ends.
G. messageendevent indicates that a message is sent to other processes at the end of the process.
H. multipleendevent indicates that multiple end events are executed at the end of the process, that is, multiple end events can be added to the multipleendevent and executed simultaneously.
Processdiworkflow. getbusinessprocpolicypoolname ("firstpool"). addactivity (New noneendevent () {name = "nonestartevent "});
The above Code adds an noneendevent to the process named "firstpool.

The intermediate event will be explained in subsequent essays. The demo about the start event and end event will be released and downloaded in the next few days.
Thank you for your advice.

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.