[rules-users] expand rules with dsl

Thierry B jboss-rules at tbzone.org
Mon Dec 1 03:56:15 EST 2008


Hello,

I've a question about drl and dsl with drools 4.0.

I've this rule :

rule "Contexte1"
	when
	   msg : Message(payload : payload)
	   eval (DOMUtil.xpathEquals(payload, "/Root/aaaa", "bbb"))
	   eval (DOMUtil.xpathEquals(payload, "/Root/cccc", "dddd"))
	then
           System.out.println ("Contexte 1 ************* : OK");
end

I use a dsl, to make it work, so now my drl is like that :

rule "Contexte1"
	when
		>msg : Message(payload : payload)
		xpathEquals "/Root/aaaa" "bbb"
		xpathEquals "/Root/cccc" "dddd"
	then
		Log : "Contexte 1 ************* : OK";
end

I was forced to make an ">" at the line "msg : Message(payload : payload)"
otherwise, he tells me that he can't expand that line.

There is a way to :
- avoid to put the ">" even if I have to add something else to the dsl ?
- avoid the line "msg : Message(payload : payload)" in my drl and simplify
my dsl so that xPathEquals "know" that the "payload" variable come from
any object Message in Working Memory ?

Thanks :-)




More information about the rules-users mailing list