Drools Kie
Drools Kie Overview
Kie
KIE(Knowledge Is Everything),知识就是一切的简称。JBoss一系列项目的总称,在《Drools使用概述》章节已经介绍了KIE包含的大部分项目。它们之间有一定的关联,通用一些API。比如涉及到构建(building)、部署(deploying)和加载(loading)等方面都会以KIE作为前缀来表示这些是通用的API。
- Common terms for combining common libraries and other parts of jBPM, Drools and Fusion
- Stands for Knowledge Is Everything KIE所包含的子项目结构图:
Kie life cycle
无论是Drools还是JBPM,生命周期都包含以下部分:
- 编写:编写规则文件,比如:DRL,BPMN2、决策表、实体类等。
- 构建:构建一个可以发布部署的组件,对于KIE来说是JAR文件。
- 测试:部署之前对规则进行测试。
- 部署:利用Maven仓库将jar部署到应用程序。
- 使用:程序加载jar文件,通过KieContainer对其进行解析创建KieSession。
- 执行:通过KieSession对象的API与Drools引擎进行交互,执行规则。
- 交互:用户通过命令行或者UI与引擎进行交互。
- 管理:管理KieSession或者KieContainer对象。
Fact Object
Fact对象是指在使用Drools 规则时,将一个普通的JavaBean对象插入到规则引擎的 WorkingMemory当中的对象。规则可以对Fact对象进行任意的读写操作。Fact对象不是对原来的JavaBean对象进行Clone,而是使用传入的JavaBean对象的引用。规则在进行计算时需要的应用系统数据设置在Fact对象当中,这样规则就可以通过对Fact对象数据的读写实现对应用数据的读写操作。
Fact对象通常是一个具有getter和setter方法的POJO对象,通过getter和setter方法可以方便的实现对Fact对象的读写操作,所以我们可以简单的把 Fact 对象理解为规则与应用系统数据交互的桥梁或通道。 当Fact对象插入到WorkingMemory当中后,会与当前WorkingMemory当中所有的规则进行匹配,同时返回一个FactHandler对象。FactHandler对象是插入到WorkingMemory当中Fact对象的引用句柄,通过FactHandler对象可以实现对Fact对象的删除及修改等操作。
前面的实例中通过调用insert方法将Product对象插入到WorkingMemory当中,Product对象插入到规则中之后就是说为的FACT对象。如果需要插入多个FACT对象,多次调用insert方法,并传入对应FACT对象即可。
Business Rules Manager
- allows people to manage rules in a multi user environment
- single point of truth for business rules
When to use Kie
- versions/deployment of rules,
- let non-technical people create/update/view rules
- embedded in existing applications
- no existing infrastructure
- lots of "business" rules
- can be used on its own, or with the IDE
When to not use Kie
- mostly technical rules
- part of an application rather than corporate solution
- existing infrastructure and GUI
Kie Users
- Business Analysts
- Rule experts
- Developers
- Administrators
- Managers (as documentation and analysis tool)
Features
- Multiple types of rule editors (GUI, text)
- Version control (historical assets)
- Build and deploy
- Store multiple rule "assets" together as a package
- Human Task console
Starting KIE
Starting KIE (drools 7.10):
cd /opt/jbpm-server-7.10.0.Final-dist/bin/
. standalone.sh
open a web browser and go to localhost:8080/jbpm-console
2
3
4
Apply Discount
Creating a Fact Type
Add Asset -> Data Object ** Data Object: ShoppingCart
Create new field ** Id: totalPrice ** Label: Total Price ** Type: BigDecimal
Save (upper right corner)
Looking at generated POJO
- Switch to Source tab
package npou.npproj;
/**
* This class was automatically generated by the data modeler tool.
*/
public class ShoppingCart implements java.io.Serializable {
static final long serialVersionUID = 1L;
@org.kie.api.definition.type.Label(value = "Total Price")
private java.math.BigDecimal totalPrice;
public ShoppingCart() {
}
public ShoppingCart(java.math.BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public java.math.BigDecimal getTotalPrice() {
return this.totalPrice;
}
public void setTotalPrice( java.math.BigDecimal totalPrice ) {
this.totalPrice = totalPrice;
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Drools Kie - Example
Creating a Rule
Add Asset -> Guided Rule
Resource Name: Apply Tall Order Discount
Enter details as below
View Source should return
package npou.npproj;
import java.lang.Number;
rule "Apply Tall Order Discount"
dialect "mvel"
when
$sc : ShoppingCart( $tp : totalPrice >= 10000.0B )
then
modify( $sc ) {
setTotalPrice( $tp*0.9 )
}
end
2
3
4
5
6
7
8
9
10
11
12
13
Creating a Test Scenario
- Create New Asset-> Test Scenario
- Resource Name: Apply Discount Test
- Run Scenario
Dealing with Recursion
- Let us try to add a test for order value of 15000 and set EXPECT section to 13500
No-Loop Attribute
We need to ad no-loop attribute
package com.nobleprog.npproj;
import java.lang.Number;
rule "Apply Tall Order Discount"
dialect "mvel"
no-loop true
when
$sc : ShoppingCart( $tp : totalPrice >= 10000.0B )
then
modify( $sc ) {
setTotalPrice( $tp*0.9 )
}
end
2
3
4
5
6
7
8
9
10
11
12
13
14
- Correct test should look like that
Drools Kie - Decision Table
Applying Progressive Discounts
We want to apply discounts according to the table below: 0 - 9,999 -> 0% 10,000 - 49,999 -> 10% 50,000 - 79,999 -> 12% 80,000 - above -> 15%
Modification to previous scenario
- Disable ''Apply Tall Order Discount.rdrl'' by renaming it to ''Apply Tall Order Discount.rdrl.disabled''
- In Data Objects -> ShoppingCart add new field discount:BigDecimal
Guided Decision Table
- Create New Asset -> Guided Decision Table ** Name: Progressive Discount Table
Applying Progressive Discounts - Source
package npou.npproj;
//from row number: 1
rule "Row 1 Progressive Decision Table"
dialect "mvel"
when
$sc : ShoppingCart( totalPrice >= 80000.0B )
then
modify( $sc ) {
setDiscount( 0.15B )
}
end
//from row number: 2
rule "Row 2 Progressive Decision Table"
dialect "mvel"
when
$sc : ShoppingCart( totalPrice >= 50000.0B , totalPrice < 80000.0B )
then
modify( $sc ) {
setDiscount( 0.12B )
}
end
//from row number: 3
rule "Row 3 Progressive Decision Table"
dialect "mvel"
when
$sc : ShoppingCart( totalPrice >= 10000.0B , totalPrice < 50000.0B )
then
modify( $sc ) {
setDiscount( 0.10B )
}
end
//from row number: 4
rule "Row 4 Progressive Decision Table"
dialect "mvel"
when
$sc : ShoppingCart( totalPrice < 10000B )
then
modify( $sc ) {
setDiscount( 0B )
}
end
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Knowledge Session
Stateless Knowledge Session
A stateless session can be called like a function passing it some data and then receiving some results back. Some common use cases for stateless sessions are, but not limited to:
- Validation
- Is this person eligible for a mortgage?
- Calculation
- Compute a mortgage premium.
- Routing and Filtering
- Filter incoming messages, such as emails, into folders.
- Send incoming messages to a destination.
Stateful Knowledge Session
Stateful Sessions are long lived and allow iterative changes over time. Some common use cases for Stateful Sessions are, but not limited to:
- Monitoring
- Stock market monitoring and analysis for semi-automatic buying.
- Diagnostics
- Fault finding, medical diagnostics
- Logistics
- Parcel tracking and delivery provisioning
- Compliance
- Validation of legality for market trades.
kmodule.xml
The kmodule.xml file is the descriptor that selects resources to knowledge bases and configures those knowledge bases and sessions.
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="kbase1">
<ksession name="ksession1"/>
</kbase>
<kbase name="kbase2" packages="org.some.pkg">
<ksession name="ksession2"/>
</kbase>
<kbase name="kbase3" includes="kbase2" packages="org.some.pkg2">
<ksession name="ksession3"/>
</kbase>
<kbase name="kbase4" packages="org.some.pkg, org.other.pkg">
<ksession name="ksession4"/>
</kbase>
<kbase name="kbase5" packages="org.*">
<ksession name="ksession5"/>
</kbase>
<kbase name="kbase6" packages="org.some.*">
<ksession name="ksession6"/>
</kbase>
</kmodule>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
*'kbase1' includes all resources from the KieModule.
- The other KieBases include resources from other selected folders, via the 'packages' attribute.
- Note the use wildcard '*' use, to select this package and all packages below it.
Run KIE with Docker
drools workbench start
docker run -p 8080:8080 -p 8001:8001 -d --name drools-workbench jboss/drools-workbench-showcase:latest
kie server start
docker run -p 8180:8080 -d --name kie-server --link drools-wb:kie-wb jboss/kie-server-showcase:latest
kie server integration with workbench
when the workbench and kie-server are both started correctly, the kie server will be in the server list of workbench
KIE Server Rest API
Basic URL
The base URL for these will remain as the endpoint defined earlier (for example: http://SERVER:PORT/CONTEXT/services/rest/server/ )
[Get] (/)
Returns the Execution Server information
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
<kie-server-info>
<capabilities>KieServer</capabilities>
<capabilities>BRM</capabilities>
<capabilities>BPM</capabilities>
<capabilities>CaseMgmt</capabilities>
<capabilities>BPM-UI</capabilities>
<capabilities>BRP</capabilities>
<capabilities>DMN</capabilities>
<capabilities>Swagger</capabilities>
<location>http://172.17.0.3:8080/kie-server/services/rest/server</location>
<messages>
<content>Server KieServerInfo{serverId='kie-server-e65b93b4c4f8', version='7.14.0.Final', name='kie-server-e65b93b4c4f8', location='http://172.17.0.3:8080/kie-server/services/rest/server', capabilities=[KieServer, BRM, BPM, CaseMgmt, BPM-UI, BRP, DMN, Swagger], messages=null}started successfully at Mon Nov 26 03:07:30 UTC 2018</content>
<severity>INFO</severity>
<timestamp>2018-11-26T03:07:30.931Z</timestamp>
</messages>
<name>kie-server-e65b93b4c4f8</name>
<id>kie-server-e65b93b4c4f8</id>
<version>7.14.0.Final</version>
</kie-server-info>
</response>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[POST] /config
Using POST HTTP method, you can execute various commands on the Execution Server. E.g: create-container, list-containers, dispose-container and call-container.
CreateContainerCommand
GetServerInfoCommand
ListContainersCommand
CallContainerCommand
DisposeContainerCommand
GetContainerInfoCommand
GetScannerInfoCommand
UpdateScannerCommand
UpdateReleaseIdCommand
The commands itself can be found in the org.kie.server.api.commands package.
[GET] /containers
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="List of created containers">
<kie-containers>
<kie-container container-alias="ebiz" container-id="ebiz_1.0.0" status="STARTED">
<config-items>
<itemName>KBase</itemName>
<itemValue></itemValue>
<itemType>BPM</itemType>
</config-items>
<config-items>
<itemName>KSession</itemName>
<itemValue></itemValue>
<itemType>BPM</itemType>
</config-items>
<config-items>
<itemName>MergeMode</itemName>
<itemValue>MERGE_COLLECTIONS</itemValue>
<itemType>BPM</itemType>
</config-items>
<config-items>
<itemName>RuntimeStrategy</itemName>
<itemValue>SINGLETON</itemValue>
<itemType>BPM</itemType>
</config-items>
<messages>
<content>Container ebiz_1.0.0 successfully created with module com.freshal:ebiz:1.0.1.</content>
<severity>INFO</severity>
<timestamp>2018-11-26T03:07:35.243Z</timestamp>
</messages>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.1</version>
</release-id>
<resolved-release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.1</version>
</resolved-release-id>
<scanner status="DISPOSED"/>
</kie-container>
</kie-containers>
</response>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[GET] /containers/{id}
Returns the status and information about a particular container. For example, executing http://SERVER:PORT/CONTEXT/services/rest/server/containers/MyProjectContainer could return the following example container info.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Info for container ebiz_1.0.0">
<kie-container container-alias="ebiz" container-id="ebiz_1.0.0" status="STARTED">
<config-items>
<itemName>KBase</itemName>
<itemValue></itemValue>
<itemType>BPM</itemType>
</config-items>
<config-items>
<itemName>KSession</itemName>
<itemValue></itemValue>
<itemType>BPM</itemType>
</config-items>
<config-items>
<itemName>MergeMode</itemName>
<itemValue>MERGE_COLLECTIONS</itemValue>
<itemType>BPM</itemType>
</config-items>
<config-items>
<itemName>RuntimeStrategy</itemName>
<itemValue>SINGLETON</itemValue>
<itemType>BPM</itemType>
</config-items>
<messages>
<content>Container ebiz_1.0.0 successfully created with module com.freshal:ebiz:1.0.1.</content>
<severity>INFO</severity>
<timestamp>2018-11-26T03:07:35.243Z</timestamp>
</messages>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.1</version>
</release-id>
<resolved-release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.1</version>
</resolved-release-id>
<scanner status="DISPOSED"/>
</kie-container>
</response>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[PUT] /containers/{id}
Allows you to create a new Container in the Execution Server. For example, to create a Container with the id of MyRESTContainer the complete endpoint will be: http://SERVER:PORT/CONTEXT/services/rest/server/containers/MyRESTContainer. Example Request to create a container
<kie-container container-id="MyRESTContainer">
<release-id>
<artifact-id>Project1</artifact-id>
<group-id>com.redhat</group-id>
<version>1.0</version>
</release-id>
</kie-container>
2
3
4
5
6
7
[DELETE] /containers/{id}
Disposes the Container specified by the id. For example, executing http://SERVER:PORT/CONTEXT/services/rest/server/containers/MyProjectContainer using the DELETE HTTP method will return the following server response:
<response type="SUCCESS" msg="Container MyProjectContainer successfully disposed."/>
[POST] /containers/instances/{id}
Executes operations and commands against the specified Container. You can send commands to this Container in the body of the POST request. For example, to fire all rules for Container with id MyRESTContainer (http://SERVER:PORT/CONTEXT/services/rest/server/containers/instances/MyRESTContainer), you would send the fire-all-rules command to it as shown below (in the body of the POST request):
<fire-all-rules/>
Following is the list of supported commands:
- AgendaGroupSetFocusCommand
- ClearActivationGroupCommand
- ClearAgendaCommand
- ClearAgendaGroupCommand
- ClearRuleFlowGroupCommand
- DeleteCommand
- InsertObjectCommand
- ModifyCommand
- GetObjectCommand
- InsertElementsCommand
- FireAllRulesCommand
- QueryCommand
- SetGlobalCommand
- GetGlobalCommand
- GetObjectsCommand
- BatchExecutionCommand
[GET] /containers/{id}/release-id
Returns the full release id for the Container specified by the id.
[POST] /containers/{id}/release-id
Allows you to update the release id of the container deployment. Send the new complete release id to the Server.
[GET] /containers/{id}/scanner
Returns information about the scanner for this Container’s automatic updates.
[POST] /containers/{id}/scanner
Allows you to start or stop a scanner that controls polling for updated Container deployments. To start the scanner, send a request similar to: http://SERVER:PORT/CONTEXT/services/rest/server/containers/{container-id}/scanner with the following POST data.
JSON Format
request body:
{
"lookup": null,
"commands":[
{
"insert": {
"object": {
"com.freshal.ebiz.Cart":{
"totalPrice": "10001.00"
}
},
"return-object":true,
"out-identifier": "cart"
}
},
{
"fire-all-rules":{}
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
response
{
"type" : "SUCCESS",
"msg" : "Container ebiz_1.0.0 successfully called.",
"result" : {
"execution-results" : {
"results" : [ {
"value" : {"com.freshal.ebiz.Cart":{
"totalPrice" : 10001.00,
"discount" : 0.9
}},
"key" : "cart"
} ],
"facts" : [ {
"value" : {"org.drools.core.common.DefaultFactHandle":{
"external-form" : "0:2:1389560427:1389560427:2:DEFAULT:NON_TRAIT:com.freshal.ebiz.Cart"
}},
"key" : "cart"
} ]
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
or use curl command to test
curl -X POST -H 'Content-type: application/json' -u 'kieserver:kieserver1!' --data @data.json http://localhost:8180/kie-server/services/rest/server/containers/instances/ebiz_1.0.0
some docs said that the command should be sent with X-KIE-ContentType:JSON
,but it seems just using -H 'Content-type: application/json' is ok .
Drools controller REST API
base URL
indeed, access the kie web(workbench)
http://localhost:8080/drools-wb/rest/controller
[GET] /management/servers
Returns a list of Kie Server templates
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<server-template-list>
<server-template>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
<container-specs>
<container-id>ebiz_1.0.1</container-id>
<container-name>ebiz</container-name>
<server-template-key>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
</server-template-key>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.0</version>
</release-id>
<configs>
<entry>
<key>PROCESS</key>
<value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<runtimeStrategy>SINGLETON</runtimeStrategy>
<kbase></kbase>
<ksession></ksession>
<mergeMode>MERGE_COLLECTIONS</mergeMode>
</value>
</entry>
<entry>
<key>RULE</key>
<value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<scannerStatus>STOPPED</scannerStatus>
</value>
</entry>
</configs>
<status>STARTED</status>
</container-specs>
<container-specs>
<container-id>ebiz_1.0.0</container-id>
<container-name>ebiz</container-name>
<server-template-key>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
</server-template-key>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.1</version>
</release-id>
<configs>
<entry>
<key>PROCESS</key>
<value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<runtimeStrategy>SINGLETON</runtimeStrategy>
<kbase></kbase>
<ksession></ksession>
<mergeMode>MERGE_COLLECTIONS</mergeMode>
</value>
</entry>
<entry>
<key>RULE</key>
<value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<scannerStatus>STOPPED</scannerStatus>
</value>
</entry>
</configs>
<status>STARTED</status>
</container-specs>
<configs/>
<server-instances>
<server-instance-id>kie-server-e65b93b4c4f8@172.17.0.3:8080</server-instance-id>
<server-name>kie-server-e65b93b4c4f8@172.17.0.3:8080</server-name>
<server-template-id>kie-server-e65b93b4c4f8</server-template-id>
<server-url>http://172.17.0.3:8080/kie-server/services/rest/server</server-url>
</server-instances>
<capabilities>RULE</capabilities>
<capabilities>PROCESS</capabilities>
<capabilities>PLANNING</capabilities>
</server-template>
</server-template-list>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
[GET] /management/servers/{id}
Returns a Kie Server template
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<server-template-details>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
<container-specs>
<container-id>ebiz_1.0.1</container-id>
<container-name>ebiz</container-name>
<server-template-key>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
</server-template-key>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.0</version>
</release-id>
<configs>
<entry>
<key>PROCESS</key>
<value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<runtimeStrategy>SINGLETON</runtimeStrategy>
<kbase></kbase>
<ksession></ksession>
<mergeMode>MERGE_COLLECTIONS</mergeMode>
</value>
</entry>
<entry>
<key>RULE</key>
<value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<scannerStatus>STOPPED</scannerStatus>
</value>
</entry>
</configs>
<status>STARTED</status>
</container-specs>
<container-specs>
<container-id>ebiz_1.0.0</container-id>
<container-name>ebiz</container-name>
<server-template-key>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
</server-template-key>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.1</version>
</release-id>
<configs>
<entry>
<key>PROCESS</key>
<value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<runtimeStrategy>SINGLETON</runtimeStrategy>
<kbase></kbase>
<ksession></ksession>
<mergeMode>MERGE_COLLECTIONS</mergeMode>
</value>
</entry>
<entry>
<key>RULE</key>
<value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<scannerStatus>STOPPED</scannerStatus>
</value>
</entry>
</configs>
<status>STARTED</status>
</container-specs>
<configs/>
<server-instances>
<server-instance-id>kie-server-e65b93b4c4f8@172.17.0.3:8080</server-instance-id>
<server-name>kie-server-e65b93b4c4f8@172.17.0.3:8080</server-name>
<server-template-id>kie-server-e65b93b4c4f8</server-template-id>
<server-url>http://172.17.0.3:8080/kie-server/services/rest/server</server-url>
</server-instances>
<capabilities>RULE</capabilities>
<capabilities>PROCESS</capabilities>
<capabilities>PLANNING</capabilities>
</server-template-details>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
[PUT] /management/server/{id}
Creates a new Kie Server template with the specified id
Example Request to create a new Kie Server template
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<server-template-details>
<server-id>test-demo</server-id>
<server-name>test-demo</server-name>
<configs/>
<capabilities>RULE</capabilities>
<capabilities>PROCESS</capabilities>
<capabilities>PLANNING</capabilities>
</server-template-details>
2
3
4
5
6
7
8
9
[DELETE] /management/server/{id}
Deletes a Kie Server template with the specified id
[GET] /management/server/{id}/containers
Returns all containers on given server
localhost:8080/drools-wb/rest/controller/management/servers/kie-server-e65b93b4c4f8/containers
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<container-spec-list>
<container-spec>
<container-id>ebiz_1.0.1</container-id>
<container-name>ebiz</container-name>
<server-template-key>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
</server-template-key>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.0</version>
</release-id>
<configs>
<entry>
<key>PROCESS</key>
<value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<runtimeStrategy>SINGLETON</runtimeStrategy>
<kbase></kbase>
<ksession></ksession>
<mergeMode>MERGE_COLLECTIONS</mergeMode>
</value>
</entry>
<entry>
<key>RULE</key>
<value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<scannerStatus>STOPPED</scannerStatus>
</value>
</entry>
</configs>
<status>STARTED</status>
</container-spec>
<container-spec>
<container-id>ebiz_1.0.0</container-id>
<container-name>ebiz</container-name>
<server-template-key>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
</server-template-key>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.1</version>
</release-id>
<configs>
<entry>
<key>PROCESS</key>
<value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<runtimeStrategy>SINGLETON</runtimeStrategy>
<kbase></kbase>
<ksession></ksession>
<mergeMode>MERGE_COLLECTIONS</mergeMode>
</value>
</entry>
<entry>
<key>RULE</key>
<value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<scannerStatus>STOPPED</scannerStatus>
</value>
</entry>
</configs>
<status>STARTED</status>
</container-spec>
</container-spec-list>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
[GET] /management/server/{id}/containers/{containerId}
Returns the Container information including its release id and configuration
localhost:8080/drools-wb/rest/controller/management/servers/kie-server-e65b93b4c4f8/containers/ebiz_1.0.0
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<container-spec-details>
<container-id>ebiz_1.0.0</container-id>
<container-name>ebiz</container-name>
<server-template-key>
<server-id>kie-server-e65b93b4c4f8</server-id>
<server-name>kie-server-e65b93b4c4f8</server-name>
</server-template-key>
<release-id>
<artifact-id>ebiz</artifact-id>
<group-id>com.freshal</group-id>
<version>1.0.1</version>
</release-id>
<configs>
<entry>
<key>PROCESS</key>
<value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<runtimeStrategy>SINGLETON</runtimeStrategy>
<kbase></kbase>
<ksession></ksession>
<mergeMode>MERGE_COLLECTIONS</mergeMode>
</value>
</entry>
<entry>
<key>RULE</key>
<value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<scannerStatus>STOPPED</scannerStatus>
</value>
</entry>
</configs>
<status>STARTED</status>
</container-spec-details>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[PUT] /management/server/{id}/containers/{containerId}
Creates a new Container with the specified containerId and the given release id and optionally configuration Example Server Request:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<container-spec-details>
<container-id>hr</container-id>
<container-name>hr</container-name>
<server-template-key>
<server-id>demo</server-id>
</server-template-key>
<release-id>
<artifact-id>HR</artifact-id>
<group-id>org.jbpm</group-id>
<version>1.0</version>
</release-id>
<configs>
<entry>
<key>PROCESS</key>
<value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<strategy>Singleton</strategy>
<kie-base-name></kie-base-name>
<kie-session-name></kie-session-name>
<merge-mode>Merge Collections</merge-mode>
</value>
</entry>
<entry>
<key>RULE</key>
<value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<scanner-status>STOPPED</scanner-status>
</value>
</entry>
</configs>
<status>STARTED</status>
</container-spec-details
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[DELETE] /management/server/{id}/containers/{containerId}
Disposes a Container with the specified containerId
[POST] /management/server/{id}/containers/{containerId}/status/started
Starts the Container. No request body required
[POST] /management/server/{id}/containers/{containerId}/status/stopped
Stops the Container. No request body required