[rules-users] Intercept event handling / why rule salience does not affect execution order?
jpullmann
jaroslav.pullmann at fit.fraunhofer.de
Fri Oct 26 05:50:54 EDT 2012
Hello,
in my scenario part of the KB is managed by means of "command events".
Rules with a low salience consume these events, assert, modify or retract
facts and remove the command event afterwards. Rules from separate files
with a higher salience are expected to transparently intercept handling
of these commands, but regardless of conditions like read order, salience
value the intercepting rules are called (or not) in an unpredictable
manner.
Example default handler:
rule "Create finite context"
salience -10
when
$start : StartCommand( time < endTime ) from entry-point
"events/context"
not( Context( name == $start.name ) )
then
insert(new TemporalContext( $start.getName(), $start.getTime(),
$start.getEndTime() ));
retract($start);
end
Example intermediary handler:
rule "Intercept context creation"
salience 10
when
$start : StartCommand() from entry-point "events/context"
not( Context( name == $start.name ) )
then
System.out.println( "Context creation intercepted: "+$start);
end
While this roughly worked with Drools 5.4, the results vary significantly
in Drools 5.5.0* for every test run. The salience attribute alone
apparently
does not guarantee for proper invocation of the intermediary handlers ?
Thank you
Jaro
--
View this message in context: http://drools.46999.n3.nabble.com/Intercept-event-handling-why-rule-salience-does-not-affect-execution-order-tp4020506.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list