[rules-users] How to inovke a Service...

Edson Tirelli tirelli at post.com
Fri Feb 9 14:37:10 EST 2007


   Seems a bug to me. It should be possible to call it from within the 
function.

   May I ask you please to open a JIRA attaching a sample code that 
generates the problem?

   Thank you,
    Edson

jdepaul wrote:

>Thanks for a great example - I was able to invoke myService from the
><consequence> block in my rules, but NOT from a Function that I define...  
>is this a limitation, or is there some other syntax when invoking from a
>function?
>
>
>rule "Shipper Match"
>	salience 90
>	when
>		shipperGI : GateIn ( customerId == "NISSAN", primaryShipperId == "yellow"
>) 
>	then
>		myService.sendNotification(shipperGI, Constants.SHIPPER_MATCH);	 <-- This
>Works
>		// notifyPartNer(shipperGI, COnstants.SHIPPER_MATCH);  <-- This DOESN'T
>WORK!  
>end
>
>
>// Match found - notify customer
>function void notifyPartner(GateIn _event, String _action ) {
>	System.out.println("Invoking Service for action = " + _action );
>	//myService.sendNotification(_event, _action);  <-- Never gets to here...
>crashes...
>}
>
>
>
>
>
>Edson Tirelli-3 wrote:
>  
>
>>>  So, for exaple, you can have a helper class that has the actual code
>>>to call the service you want and set it as a global for your rulebase.
>>>Then in the consequence you call this class method with the given
>>>paramenters.
>>>      
>>>
>>...
>>
>>    
>>
>
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list