Hi!
I know that this topic has been partially covered in this:
http://www.nabble.com/Initialize-Global-to13388685.html#a13388685
thread.
Nevertheless I think that the geiven answers are only partially satisfying.
Basically the main problem is still unsolved:
One has a global variable inside the DRL and wants to initialize it in a
rule (most likely the initial rule). Althoug several posts in the above
thread point out, that this should be easily possible doing this:
global String test
rule "Initial Rule"
when
then
session.setGlobal("test", "Hello World");
System.out.println(test);
will lead to infinite recursions of this initial rule without the code ever
reaching the println()!
I tried several variations of the above. At least of of the ones that have
been used in the aforementioned thread: using no-loop true, using
initialization from Java application using a function call, testing for null
pointer with eval(test == null) and so on.
I'm using Drools 4.0.3 and I have the strong impression that this is a bug,
as all the code examples mentioned in the other thread DO NOT SOLVE the
problem. The recursion still exists.
Thanks for any help in advance!
--
View this message in context:
http://www.nabble.com/Initiating-global-in-rule-tp17081556p17081556.html
Sent from the drools - user mailing list archive at
Nabble.com.