I have 2 drools file in the same package com.sample.order.rules orders.drl and order-summary.drl. I want to process all the orders in orders.drl and then from the results of order.drl processing, create an order summary using order-summary.drl. I currently control the order of execution by setting all the saliences in order-summary.drl to -1. Is it possible to solve this problem any other way? The problem is the number of rules is increasing and adding salience to every rule in order-summary.drl just doesn't feel right.
It is possible to control the execution order of groups of rules with the attribute ruleflow-group
, see examples from the docs. In general, the approach is:
ruleflow-group
attribute.ruleflow-group
s with a Business Process TaskThis allows you to (optionally) only trigger your Summary steps when some conditions in the previous Orders step have been satisfied. I would suggest looking at the Mortgage_Process example provided by the Drools Business Central Showcase Docker image. To set up the KIE Execution Server API to test your rules and processes iteratively, see the docker-compose set up here.
Step 1
rule "order rule 1"
ruleflow-group "orders"
when
Order ( value > 10 )
then
insert ( new Shipment () );
end
rule "summary rule 1"
ruleflow-group "summary"
when
Shipment ()
then
// do stuff
end