I am new in Drools. I am using Drools version 5.1.0
My requirement is kind of request response, where I have to perform some
checks for the request and respond the result. Hence, I decided to go with
stateless knowledge session.
I have prepared .DRL file and it contains set of rules. When some request
receives I have to identify the rule(s) belongs to that request and then
fire the rule(s).
I am not able to figure out how to categories the rules request wise in
DRL file? Also, how to fire only those rules which belongs to the
For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are
rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3
belongs to Rq2 and R4, R5 belongs to Rq3.
When some request receives only its belonging rules should be fired. For
example, on receiving of Rq2 only R3 should be fired.
Please provide me some code snipped or link.
One way could be to have conditions in your rules that check what kind of
request it is. Without knowing your problem in detail it's hard to know if
this is feasible. E.g. you could insert a request object as a fact into the
session and let rules in R3 have condition:
Request(type = "Rq2")
If you switch to stateful session instead of stateless you could use agenda
groups to achieve something similar. See Drools Expert user guide for
details on how to use agenda groups.
View this message in context:
Sent from the Drools: User forum mailing list archive at Nabble.com