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

Mark Proctor mproctor at codehaus.org
Fri Aug 31 22:52:21 EDT 2012


Look t the script element and the set-global command:
https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring.xsd

Mark
On 31 Aug 2012, at 20:09, dunnlow <dunnlow at yahoo.com> wrote:

> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list