[rules-users] Problem while using the global - Drools 3.0.6

Natraj Gudla natraj.gudla at gmail.com
Mon Jul 2 03:11:07 EDT 2007


Hello,

I am using Drools 3.0.6. While using a global variable in a function, the
compiler complains it cannot resolve the global variable name. Something
like below

*

global* com.*sample*.ExampleLogger *customLogger*;
*

function* *void* logMessage(String msg){

customLogger.logMessage("Log Message from the function");

}
In the above code, it complains "customLogger cannot be resolved". I am able
to refer the global in the consequence of a rule directly. What is the
problem using the reference within a function.

On the other hand, i am able to do something like
* *

function *void* logMessage(ExampleLogger custLogger,String msg){

custLogger.logMessage(msg+" Accept gloabal as function parameter");

}
and call from the consequence of a rule : logMessage(customLogger);  // I am
passing the global to the function as an argument and then use it to log a
message.
This way is working. But not the first way of using the global in the
function.

Any help??

Thanks
-- 
Natraj Gudla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070702/5e5249b7/attachment.html 


More information about the rules-users mailing list