For my case it enough to see if a rule is executed or not. Then I use the WorkingMemoryConsoleLogger
to see which rule was activated. I don't need to have a then
block in the rules. However, when I remove that block it returns an error. How can I fix that?
Asked
Active
Viewed 1,226 times
0

aphex
- 3,372
- 2
- 28
- 56
-
Rules are all about condition then action. If you don't want this semantic then maybe rules is a bad fit. I guess the alternative is that you could have a then that invokes a method that just does some sort of logging. Kind of a noop. – cmbaxter May 21 '13 at 16:03
-
I was using the `then` exactly for logging, but all the rules have the same then action. My idea is to add this logic to the `WorkingMemoryConsoleLogger` and not write for every rule the same then action... – aphex May 21 '13 at 16:08
-
1@cmbaxter I think your comment is a bit misleading. In general, business rules can be of two types that commonly called "evaluation type rule" and "execution type rule". Evaluation type rules answer one question: True or False. A rule of this type might look like this: "Verify that ZIP is 30040". Execution type rules can set value(s) and/or invoke action(s). They either return True if any of rule's conditions evaluated to True, or they don't return anything at all. Now, whether Drools supports both rule types or not - that's a whole different question. – Kizz May 21 '13 at 17:04
-
Sorry, I suppose my comment more refers to rules engines. I've had pretty extensive work with both Drools and iLog's JRules and every rule that we did with those engines was about `condition -> action`. I apologize if I misled anyone... – cmbaxter May 21 '13 at 17:12
1 Answers
0
I got some support from the user group. So the then
block can be empty.
rule "rule name"
when
.......
then
end

aphex
- 3,372
- 2
- 28
- 56