Drools: Decision Tables and MVEL – Quirk? Feature? Consequence?


decisiontable

drinkingrules

I had a very interesting experience today with Drools Decision Tables and MVEL.

My Decision Table has a consequence that refers to $person.name – using MVEL.

It compiled, it ran and it worked.

But, I had a setup.drl File in the same rule package as the Decision Table, and in that setup.drl I set the dialect to MVEL.

Now, move that setup.drl into a different rule package, and despite the kbase referring to both packages in the kmodule.xml, the Decision Table now fails with the error message:

> Message ( ERROR ): Rule Compilation error The field Person.name is not visible

So, a little experiment and  I created a new dialect.drl file in the same rule package as the Decision Table – that sets the dialect to “MVEL” and suddenly everything works again…

package com.skills421.examples.drools.people

dialect "mvel"

dialect.drl

Quirk? Feature? Consequence?

Either way – it’s useful to know when working with Decision Tables.

Drools version 6.3.0.Final

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s