drools kmodule属性( kbase属性,ksession属性)

kmodule.xml示例: 

<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://www.drools.org/xsd/kmodule">
    <configuration>
        <property key="drools.evaluator.supersetOf" value="org.mycompany.SupersetOfEvaluatorDefinition"/>
    </configuration>
    <kbase name="KBase1" default="true" eventProcessingMode="cloud" equalsBehavior="equality"
           declarativeAgenda="enabled" packages="org.domain.pkg1">
        <ksession name="KSession2_1" type="stateful" default="true"/>
        <ksession name="KSession2_2" type="stateless" default="false" beliefSystem="jtms"/>
    </kbase>
    <kbase name="KBase2" default="false" eventProcessingMode="stream" equalsBehavior="equality"
           declarativeAgenda="enabled" packages="org.domain.pkg2, org.domain.pkg3" includes="KBase1">
        <ksession name="KSession3_1" type="stateful" default="false" clockType="realtime">
            <fileLogger file="drools.log" threaded="true" interval="10"/>
            <workItemHandlers>
                <workItemHandler name="name" type="org.domain.WorkItemHandler"/>
            </workItemHandlers>
            <calendars>
                <calendar name="monday" type="org.domain.Monday"/>
            </calendars>
            <listeners>
                <ruleRuntimeEventListener type="org.domain.RuleRuntimeListener"/>
                <agendaEventListener type="org.domain.FirstAgendaListener"/>
                <agendaEventListener type="org.domain.SecondAgendaListener"/>
                <processEventListener type="org.domain.ProcessListener"/>
            </listeners>
        </ksession>
    </kbase>
</kmodule>

 kbase属性

官网: 

Attribute name Default value Admitted values Meaning

name

none

any

The name with which retrieve this KieBase from the KieContainer. This is the only mandatory attribute.

includes

none

any comma separated list

A comma separated list of other KieBases contained in this kmodule. The artifacts of all these KieBases will be also included in this one.

packages

all

any comma separated list

By default all the Drools artifacts under the resources folder, at any level, are included into the KieBase. This attribute allows to limit the artifacts that will be compiled in this KieBase to only the ones belonging to the list of packages.

default

false

true, false

Defines if this KieBase is the default one for this module, so it can be created from the KieContainer without passing any name to it. There can be at most one default KieBase in each module.

equalsBehavior

identity

identity, equality

Defines the behavior of Drools when a new fact is inserted into the Working Memory. With identity it always create a new FactHandle unless the same object isn’t already present in the Working Memory, while with equality only if the newly inserted object is not equal (according to its equal method) to an already existing fact.

eventProcessingMode

cloud

cloud, stream

When compiled in cloud mode the KieBase treats events as normal facts, while in stream mode allow temporal reasoning on them.

declarativeAgenda

disabled

disabled, enabled

Defines if the Declarative Agenda is enabled or not.

翻译:

属性名 默认值 允许的值 涵义

name

 none

任何值

从KieContainer中检索此KieBase的名称。这是唯一的强制属性。

includes

none

任何以逗号分隔的list 此kmodule中包含的其他KieBase的逗号分隔list,引用其他的KieBase的属性。

packages

all

任何以逗号分隔的list 默认情况下,resources资源文件夹下任何级别的所有Drools属性都包含在这个KieBase中。此属性允许将在此KieBase中编译的属性限制为仅属于包列表的属性。

default

false

true, false

定义此KieBase是否为此模块的默认值,因此可以从KieContainer创建它而不向其传递任何名称。每个模块中最多只能有一个默认的KieBase

equalsBehavior

identity

identity, equality

当一个新的fact插入工作内存时定义drools的行为,identity:除非当前的工作内存中没有这个object,否则每次都会新建一个FactHandle ;equality : 只有当这个fact在工作内存中没有equal的对象时才创建。

eventProcessingMode

cloud

cloud, stream

在云模式下编译时,KieBase将事件视为正常facts,而在流模式下则允许对它们进行时间推理。

declarativeAgenda

disabled

disabled, enabled

定义是否启用declarativeAgenda。

ksession属性

官网 :

Attribute name Default value Admitted values Meaning

name

none

any

Unique name of this KieSession. Used to fetch the KieSession from the KieContainer. This is the only mandatory attribute.

type

stateful

stateful, stateless

A stateful session allows to iteratively work with the Working Memory, while a stateless one is a one-off execution of a Working Memory with a provided data set.

default

false

true, false

Defines if this KieSession is the default one for this module, so it can be created from the KieContainer without passing any name to it. In each module there can be at most one default KieSession for each type.

clockType

realtime

realtime, pseudo

Defines if events timestamps are determined by the system clock or by a psuedo clock controlled by the application. This clock is specially useful for unit testing temporal rules.

beliefSystem

simple

simple, jtms, defeasible

Defines the type of belief system used by the KieSession.

翻译:

属性名 默认值 允许的值 涵义

name

none

any

此KieSession的唯一名称。用于从KieContainer获取KieSession。这是唯一的强制属性。

type

stateful

stateful, stateless

有状态会话(stateful)允许迭代地使用工作存储器,而无状态会话(stateless)是使用提供的数据集一次性执行工作存储器。

default

false

true, false

定义此KieSession是否是此模块的默认值,因此可以从KieContainer创建它而不向其传递任何名称。在每个模块中,每种类型最多只能有一个默认的KieSession。

clockType

realtime

realtime, pseudo

定义事件时间戳是由系统时钟还是由应用程序控制的伪时钟确定的。该时钟对于单元测试时间规则特别有用。

beliefSystem

simple

simple, jtms, defeasible

定义KieSession使用的beliefSystem的类型。

猜你喜欢

转载自blog.csdn.net/top_explore/article/details/93520046