As Program Let's go straight to the topic and see how the streaming workflow works. At least we have a general understanding.
- Load the rule into the streaming
- Set some variables used in the Rule File
- Execute the rule and save the execution result in context)
Let's take a look at the composition of the streaming rule file.
The rule file is defined in XML. The rule file consists of the following three parts:
- Rules
- Logic tests
- Structure
according to my current understanding, this rule file can define variables.
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> integer id =" 10i " value =" 10 " />
integer id =" 40i " value =" 40 " />
equivalent
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> int 10i = 10 ;< br> int 40i = 40 ;
You can also reference external variables.
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> objectlookup id =" quantityordered " objectid =" currentorder " member =" " />
Equivalent //The premise is that currentorder has been added to the context as an instance of a class. Of course, it is of a weak type.
ObjectQuantityordered=Currentorder. quantityordered;
Logical Block < Logic >
< If >
< And >
< Greaterthan Leftid = "Quantityordered" Rightid = "40i" />
</ And >
< Do >
< Evaluate ID = "Applieddiscount" >
< Parameter Name = "Percent" Value = ". 9" />
</ Evaluate >
</ Do >
</ If >
< Else >
< Evaluate ID = "Applieddiscount" >
< Parameter Name = "Percent" Value = "1" />
</ Evaluate >
</ Else >
</ Logic >
Pseudo code is If (Quantityordered > 40i)
{
Percent= 0.9;//It can be accessed by a program other than the rule, which is the result of rule execution.
}
Else
{
Percent= 1;
}
The implementation of stream pilot basically defines and uses the interface reasonably. Let's take a look at these important interfaces.
Process Method, needless to say, the most important thing is to execute the rule switch.
Not to mention the rulecontext attribute. All variables in the Rule definition file, referenced external variables, and even execution results are stored here.
namespace nxbre. flowengine. Rules |
description |
decrement * |
auto-minus integer |
exception |
throw an exception |
false, true |
|
fatalexception |
major exception |
increment |
auto-incrementing integer |
incrementinit * |
incrementor or decrementor reset. |
objectlookup |
class or instance mapped to rulecontext through reflection |
value |
any type of variable |
Ah, this form is really not neat. Make it together. Although it is ugly, it is in line with your own artist performance...
I don't need to comment on the above. I know what it means literally. I would like to emphasize that the support of regular expressions will leave a huge space for expansion.
These things are used when loading rule files. For example, xbre files must use xbusinessrulesfiledriver.
Factory to create an iflowengine instance
Okay, I said a bunch of things. It seems useless...
At least let me know what this is.