In Chapter 14, we explained the integration and use of Activiti and the rule engine. To be precise, the integration of Activiti and the Drools rule engine. After the release of Activiti6 version, Activiti began to implement the DMN specification. In other words, Activiti is implementing its own rules engine. Although it has not yet been completed, it has taken a prototype. This chapter will describe the DMN specification and the preliminary implementation of the Activit rule engine.
When the author wrote the book, Activiti’s rule engine had not been officially released, and no relevant information was found in official documents and APIs. The content of this chapter was written by the author with reference to the source code of the Activiti rule engine module. In future Activiti versions, The implementation and published documents of the rule engine may conflict with the content described in this book. Readers are encouraged to understand this situation.
The emergence background of DMNDMN is the abbreviation of English Decision Model and Notation, and its literal translation means decision model and graphics. According to the previous chapter, BPMN is a workflow specification released by OMG, and DMN is also a specification released by OMG. This specification is mainly used to define models and graphics for business decision-making. Version 1.0 was released in 2015, and the latest version is 1.1. , released in 2016.
BPMN is mainly used to standardize business processes. The logic of business decisions is defined by specifications such as PMML. For example, in some business processes, multiple decisions are needed to determine the direction of the process, and each decision must be based on its own rules. To decide, and there may be correlation between each decision, there is a gap between BPMN and PMML. Before the emergence of DMN specification, decision-makers could not participate in the business. In order to fill the gaps in the model, the DMN specification is added to define the specifications and graphics for decision-making. The DMN specification is equivalent to the bridge between the business process model and the decision-making logic model.
Although DMN only serves as a bridge between workflow and decision-making logic, in fact, the specification also contains the decision-making logic part, and is also compatible with the expression language defined by the PMML specification. In other words, the framework that implements the DMN specification will also have the ability to process business rules.
Activiti and DroolsAs a workflow engine, Activiti is not comparable to the rule engine Drools. They are more complementary. However, Activiti is currently implementing the DMN specification, and Drools implements the PMML specification. This means that Activiti's After the work engine is completed, it also includes the function of the rule engine. According to the DMN specification, the implementer of the DMN specification will also provide support for PMML. As a result, Activiti's rules engine and Drools will compete.
JBoss has the workflow engine jBPM and the rule engine Drools. Activiti itself is a workflow engine. Coupled with the rule engine added in this update, it is estimated that in the near future, Activiti will be in the field of workflow engine and rule engine. , can compete with JBoss.
DMN’s XML sampleDMN mainly defines the decision-making model. Similar to the BPMN specification, the DMN specification released by OMG contains corresponding XML constraints. The current version of Activiti implements the decision part, so this chapter only describes the decision part in DMN. For DMN XML documents, the file name suffix is generally dmn. Code Listing 15-1 is a simple DMN document.
Code Listing 15-1: codes\15\15.1\sample.dmn
The XML document in Code Listing 15-1 defines a decision node, which contains an input parameter, an output result and two rules. Note that the bold code in the code listing uses the startsWith method, which defines that if the parameter string starts with "Angus", the first rule will be triggered, and if the parameter character starts with "Paris", the second rule will be triggered. The description of each element in the XML document will be described in subsequent chapters.
The article is reprinted from Open Source China Community [http://www.oschina.net]The above is the detailed content of Learn about dynamic decision management systems. For more information, please follow other related articles on the PHP Chinese website!