Objects resulting from &quot;from&quot;+expression are not facts in Working Memory,<br>and thus they aren&#39;t events either.<br><br>You might investigate a similar approach where you have, for each rule<br>according to <br>
<br>rule &quot;example&quot;<br>
   when<br>
     Event1(..) from entry-point Event1Store<br>
     Event2(..) from entry-point Event2Store<br>
   then //...<br>
end<br>
<br>an additional rule<br><br>rule &quot;example sentinel&quot;<br>

   when<br>

     Event1(..) from entry-point Event1Store<br>

     $es: Event2Sentinel( evRef != null ) //  from entry-point Event2Store<br>

   then<br>    Event2 ev2 = $event2Provider.evaluate();<br>    insert( new Event2() );<br>    modify( $es ){ setEvRef( ev2 ) } <br>

end<br><br>You will have to update the sentinel when the Event2 is retracted. <br>This depends how you want this done, but the following rule should<br>work in any case_<br><br>rule &quot;clear sentinel&quot;<br>when<br>
    $es: Event2Sentinel( $er: evRef != null )<br>    not Event2( this == $er )<br>then<br>    modify( $es ){ setEvRef( null ) } <br>end<br><br>I&#39;m not sure why you need events in the first place, but you can use<br>explicit retract for events as well.<br>
<br>I&#39;m not sure whether you need the &quot;from&quot;+entry-point at all. <br><br>-W<br><br><br><div class="gmail_quote">On 6 February 2011 00:07, James Willans <span dir="ltr">&lt;<a href="mailto:james.willans@ceteva.com">james.willans@ceteva.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<br>
<br>
I&#39;m a new user of Drools and have experimented with the basics.  I am<br>
interested in processing events and have had success when defining rules<br>
of the type:<br>
<br>
rule &quot;example&quot;<br>
   when<br>
     Event1(..) from entry-point Event1Store<br>
     Event2(..) from entry-point Event2Store<br>
   then<br>
     System.out.println(&quot;Fired!&quot;);<br>
end<br>
<br>
Where events of type Event1 and Event2 are continually injected into<br>
entry-points within the working memory.<br>
<br>
The events I have in mind are formed from data that sit in data stores<br>
that are expensive to access and I would like to explore strategies for<br>
minimising access to these.  In the above example, I assume that if<br>
Drools does not match the pattern Event1(..) then it will not try and<br>
match the pattern Event2(..), in which case it would not be necessary to<br>
construct facts/events which may match the Event2(..) pattern.<br>
<br>
I understand that the &#39;from&#39; statement can be used to evaluate facts<br>
that are not in working memory, on this basis I have defined proxy<br>
objects that are inserted into working memory which are then evaluated<br>
for the actual data from the database on demand:<br>
<br>
1 rule &quot;example&quot;<br>
2  when<br>
3    $event1Provider : Event1Provider()<br>
4    Event1(..) from $event1Provider.evaluate()<br>
5    $event2Provider : Event2Provider()<br>
6    Event2(..) from $event2Provider.evaluate()<br>
7  then<br>
8    System.out.println(&quot;Fired!&quot;);<br>
9 end<br>
<br>
On the basis that if line 4 fails to match, then line 5 and 6 will not<br>
get evaluated therefore avoiding accessing the database describing the<br>
Event2 fact/event.  I think that this works - but only once, since it<br>
looks like the system is treating these as facts, that don&#39;t expire,<br>
rather than events.  Is it the case that the &#39;from&#39; statement cannot be<br>
used for events in this way?  If not, what approach should be taken to<br>
addressing the problem I am trying to solve?<br>
<br>
Any direction would be much appreciated.<br>
<br>
James<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>