[rules-users] Can I capture the result of an RMI call within a pattern?

lhorton LHorton at ABCLegal.com
Thu Mar 22 12:25:10 EDT 2012


5.2.0.Final

consider this simplified example, which has RMI calls to a service to
getLocation()

rule "example"
when
   $p : Product( location != remoteService.getLocation("A") )
then
   $p.setLocation( remoteService.getLocation("A") );
end

the above rule calls the remote method twice, once in the LHS to compare to
a current value, and again in the RHS to set the value.  I would like to
capture the return value of the LHS call, to avoid making the call twice.  I
haven't been able to figure out the syntax to do this within the pattern. 
Here's one example of what I have tried:

rule "example"
when
   $p : Product( location != $loc : remoteService.getLocation("A") )
then
   $p.setLocation( $loc );
end

Does anyone know the correct syntax to accomplish this?  Or am I trying to
do the impossible?


--
View this message in context: http://drools.46999.n3.nabble.com/Can-I-capture-the-result-of-an-RMI-call-within-a-pattern-tp3848873p3848873.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list