<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3020" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=013181505-09022007><FONT face=Arial 
color=#0000ff size=2>hi James,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=013181505-09022007><FONT face=Arial 
color=#0000ff size=2>i believe 
<STRONG>event.getActivation().getTuple().getFactHandles()</STRONG> should 
do...</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=013181505-09022007><FONT face=Arial color=#0000ff 
size=2>holla</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff 
size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><BR>&nbsp;</DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>James 
Depaul<BR><B>Sent:</B> Friday, February 09, 2007 3:59 AM<BR><B>To:</B> Rules 
Users List<BR><B>Subject:</B> Re: [rules-users] How to inovke a 
Service...<BR></FONT><BR></DIV>
<DIV></DIV>
<P>Thanks Edson - <BR><BR>Two questions:<BR><BR>1) Is using Globals (as you 
mention below) same as using WorkingMemory.setApplicationData(myService) - or is 
this yet another way to do it. Is there a difference in terms of 
efficiency?<BR><BR>2) Is there a way to get to the Fact that fired the event 
from the Event object passed in the 
AgendaEventListener.afterActivationFired(Event event) <BR><BR>&gt;From an 
efficiency and performance standpoint, which way would you recommend pursuing: 
EventListener invoking a service or service invoked from global Helper class in 
current WorkingMemory? Any guidance there would be 
appreciated.<BR><BR>Thanks,<BR>James<BR><BR><BR><BR><IMG height=16 
alt="Inactive hide details for Edson Tirelli <tirelli@post.com>" 
src="cid:013181505@09022007-10AA" width=16 border=0>Edson Tirelli 
&lt;tirelli@post.com&gt;<BR><BR><BR>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR vAlign=top>
    <TD 
    style="BACKGROUND-IMAGE: url(cid:2__=08BBF80BDFE94A758f9e8a93df938@us.ibm.com); BACKGROUND-REPEAT: no-repeat" 
    width="40%">
      <UL>
        <UL>
          <UL>
            <UL><B><FONT size=2>Edson Tirelli 
              &lt;tirelli@post.com&gt;</FONT></B><FONT size=2> </FONT><BR><FONT 
              size=2>Sent by: rules-users-bounces@lists.jboss.org</FONT> 
              <P><FONT size=2>02/08/2007 02:31 PM</FONT> 
              <TABLE border=1>
                <TBODY>
                <TR vAlign=top>
                  <TD width=168 bgColor=#ffffff>
                    <DIV align=center><FONT size=2>Please respond to<BR>Rules 
                    Users List 
                  &lt;rules-users@lists.jboss.org&gt;</FONT></DIV></TD></TR></TBODY></TABLE></P></UL></UL></UL></UL></TD>
    <TD width="60%">
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR vAlign=top>
          <TD width="1%"><IMG height=1 alt="" 
            src="cid:013181505@09022007-10B1" width=58 border=0><BR>
            <DIV align=right><FONT size=2>To</FONT></DIV></TD>
          <TD width="100%"><IMG height=1 alt="" 
            src="cid:013181505@09022007-10B1" width=1 border=0><BR><FONT 
            size=2>Rules Users List 
        &lt;rules-users@lists.jboss.org&gt;</FONT></TD></TR>
        <TR vAlign=top>
          <TD width="1%"><IMG height=1 alt="" 
            src="cid:013181505@09022007-10B1" width=58 border=0><BR>
            <DIV align=right><FONT size=2>cc</FONT></DIV></TD>
          <TD width="100%"><IMG height=1 alt="" 
            src="cid:013181505@09022007-10B1" width=1 border=0><BR></TD></TR>
        <TR vAlign=top>
          <TD width="1%"><IMG height=1 alt="" 
            src="cid:013181505@09022007-10B1" width=58 border=0><BR>
            <DIV align=right><FONT size=2>Subject</FONT></DIV></TD>
          <TD width="100%"><IMG height=1 alt="" 
            src="cid:013181505@09022007-10B1" width=1 border=0><BR><FONT 
            size=2>Re: [rules-users] How to inovke a 
        Service...</FONT></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 border=0>
        <TBODY>
        <TR vAlign=top>
          <TD width=58><IMG height=1 alt="" src="cid:013181505@09022007-10B1" 
            width=1 border=0></TD>
          <TD width=336><IMG height=1 alt="" src="cid:013181505@09022007-10B1" 
            width=1 
border=0></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR><TT>&nbsp; 
&nbsp;James,<BR><BR>&nbsp; The consequence and function blocks in a DRL file are 
transformed <BR>into a plain java method. It means you can do whatever you want 
and java <BR>allows. So, if you are for instance inside an application server, 
you <BR>cat get your JNDI context from there and do your stuff. Although, it is 
<BR>usually better to have helper classes doing procedural code and keep the 
<BR>consequence code clean to make rules maintance easier.<BR><BR>&nbsp; So, for 
exaple, you can have a helper class that has the actual code <BR>to call the 
service you want and set it as a global for your rulebase. <BR>Then in the 
consequence you call this class method with the given <BR>paramenters.<BR>&nbsp; 
Example:<BR><BR>package my.package;<BR><BR>global 
my.service.package.ServiceInvoker invoker;<BR><BR>rule "Cheese in 
stock"<BR>when<BR>&nbsp; &nbsp; $p : Person( $likes : likes )<BR>&nbsp; &nbsp; 
$c : Cheese( type == $likes, quantity &gt; 0 )<BR>then<BR>&nbsp; 
&nbsp;invoker.sendMessageToPerson( $p, "Your prefered cheese 
<BR>("+$c.getType()+") is back in stock;" );<BR>end<BR><BR>&nbsp; Inside your 
ServiceInvoker class you create the code to actually send <BR>the message 
(procedural code).<BR><BR>&nbsp; This is only one way of doing it, but it is 
usually what is done.<BR><BR>&nbsp; Hope it helps.<BR><BR>&nbsp; []s<BR>&nbsp; 
Edson<BR><BR>jdepaul wrote:<BR><BR>&gt;I've done a little research since my 
first post and have been experimenting<BR>&gt;with the AgendaEventListener 
interface... &nbsp; I can register a component in<BR>&gt;WorkingMemory that will 
'listen' and be notified afterEventFired event -<BR>&gt;this could be a good 
place from which to invoke my serivce, however, the<BR>&gt;problem I'm having is 
that the event delivered doesn't seem to pass the<BR>&gt;original Fact that 
caused the Event to fire, only the rule that got<BR>&gt;activated is sent... 
&nbsp;How could I get the Fact that caused this event to<BR>&gt;fire from that 
event object?<BR>&gt;<BR>&gt;James<BR>&gt;<BR>&gt;<BR>&gt; 
&nbsp;<BR>&gt;<BR><BR><BR>-- <BR>Edson Tirelli<BR>Software Engineer - JBoss 
Rules Core Developer<BR>Office: +55 11 3124-6000<BR>Mobile: +55 11 
9218-4151<BR>JBoss, a division of Red Hat @ 
www.jboss.com<BR><BR><BR>_______________________________________________<BR>rules-users 
mailing list<BR>rules-users@lists.jboss.org<BR></TT><TT><A 
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A></TT><TT><BR></TT><BR></P></BODY></HTML>