I am trying to use Business Central's BPMN visual editor to design a business process with ruleflow groups that will be picked up by rules in a DRL file but rules in the ruleflow group are not firing.
I'm using the showcase Docker images of Drools Workbench (jboss/drools-workbench-showcase:7.18.0.Final) and KIE execution server (jboss/kie-server-showcase:7.23.0.Final) with a Docker Compose file. I am able to successfully connect and query both the workbench and KIE servers.
I set up a a new project in Business Central called example
with a Data Object call Entity
having a single String
field called name
. I then created a new DRL
file called validate with the following content:
package com.myspace.example;
rule "example validation"
when
Entity ()
then
System.out.println("validation rule fired");
end
I built and deployed the project to one of the execution servers and used Postman to POST
the below application/json
payload to http://127.0.0.1:3931/kie-server/services/rest/server/containers/instances/example_1.0.0-SNAPSHOT
{
"commands": [
{
"insert": {
"object": {
"com.myspace.example.Entity": {
"name": "Some Name"
}
},
"out-identifier": "Some identifier"
}
},
{
"fire-all-rules": {
"out-identifier": "firedActivations"
}
}
]
}
As expected, the rules fired with the following console output:
kie-server-1_1 | 09:49:37,445 INFO [stdout] (default task-1) validation rule fired
I then created a Business Process
asset in the project with the following definitions Name
: Entity
, Data Type
: Entity [com.myspace.example]
:
I updated my DRL file to add the statement ruleflow-group "validate"
, rebuilt and redeployed the project to the KIE execution servers, but now the rule does not fire when making the same request. I've also tried using the legacy BPMN2 Business Process (per the visual in the documentation) as well (on a separate project branch) with no joy. How do I correctly connect my BPMN diagrams from Business Central to ruleflow-groups defined in DRL files? What is the configuration required in the BPMN diagrams for ruleflow-groups to be activated?
now the rule does not fire when making the same request
The request you pasted is about inserting a fact in the session and calling fire all rules [nothing related to processes].
After you changed the business requirements, I understand to have a BPMN process and changed those rules as part of a ruleflow-group be executed as part of the Business Rules Task "Validate" as you depicted. Hence, you cannot re-use the same request, you need at least to insert the fact in the session AND start the BPMN process.