[rules-users] Insert global into working memory via Spring?

dunnlow dunnlow at yahoo.com
Fri Aug 31 15:09:38 EDT 2012


I am using the drools 5.4  Integration Server (with Guvnor).  

I have two instances of the Integration Server and (ideally) one instance of
the rules in Guvnor.  I would like to create some rules that depend on the
instance of the Integration Server on which they are running.  The vision is
that I would set a global variable somewhere that provided the server name
then use that variable in my rules.

I thought about adding a global variable via guvnor package configuration,
but I can only declare it (not set it).  Also, if I could do that, I would
need another knowledge base, which I am trying to avoid.

I am considering setting up a declared object (so that the rule just fires
once) and a rule that if the object doesnt exist, creates it and calls a
function that checks a System Property and sets the value (I know, I've read
not to set globals in rules).  If this rule has a high salience, this seems
like it could work - but is REALLY ugly. 

Is there a better way?

Basically, I think I want to inject that value into the knowledge session
via Spring.

Thanks for any thoughts,
-J




--
View this message in context: http://drools.46999.n3.nabble.com/Insert-global-into-working-memory-via-Spring-tp4019491.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list