Drools Integration User Guide

Turning on Drools

1 Add “fixicch2.drools = true” configuration to local.app.properties file
  or

2 Go to Administration-Application properties, Select fixicch2.drools and set current value: true= on; false=off

image-20240423-103230.png
image-20240423-103443.png

Configuration

1. Select a server- Configurations

2. Choose “Edit kmodule .xml”

3. Put own configuration in kmodule:


<kmodule xmlns=" http://jboss.org/kie/6.0.0/kmodule"> <kbase name="kbase1" packages="package1"> <ksession name="ksession1" type="stateful"/> </kbase> </kmodule>

 

  1. Choose Drools Components from Configurations:

  2. Attach the file with rules. It’s  also possible to download or remove the attached file:

File sample:

  1. Select the “Business Rules” from Configurations

  2. Add configuration:

import com.epam.fej.routing.drools.DroolsEngine
import static dsl.CommonRulesDsl.rulesDSL

DroolsEngine dre = drools as DroolsEngine

rulesDSL(routingContext as RoutingContext) {
messageRules {
messageRule("Route FIX message by decision table in kbase1") {
action {
custom {
ctx ->
dre.runStatefulAndClean("ksession1", ctx)
routingContext.getDestinationById(ctx.messageEvent.getHeader("destination")).send(ctx.messageEvent)
}
context exit
}
}
}
}

import com.epam.fej.routing.drools.DroolsEngine
import static dsl.CommonRulesDsl.rulesDSL

DroolsEngine dre = drools as DroolsEngine

rulesDSL(routingContext as RoutingContext) {
messageRules {
messageRule("Route FIX message by decision table in kbase1") {
action {
custom {
ctx ->
dre.runStatefulAndClean("ksession1", ctx)
routingContext.getDestinationById(ctx.messageEvent.getHeader("destination")).send(ctx.messageEvent)
}
context exit
}
}
}
}