Get Rule name in "then" clause in drools

Manish Mulani picture Manish Mulani · May 29, 2012 · Viewed 7.4k times · Source

Is it possible to retrieve rule name in the then clause of drool rule?

rule "A"
    when
        ---
    then
        // something that outputs "A"

Thanks.

Answer

Cyril Sochor picture Cyril Sochor · May 29, 2012

Yes, in then clause you may use expression:

drools.getRule().getName()