You are pretty close:<br>entryPoints[&quot;<span style="color: rgb(51, 102, 255);"><span style="color: rgb(255, 0, 0);">ob1 stream</span></span>&quot;].insert(mre);<br><br>Try with that.<br><br><div class="gmail_quote">2009/8/16 Justin King <span dir="ltr">&lt;<a href="mailto:justin.matthew.king@gmail.com">justin.matthew.king@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Everyone,<br><br>I&#39;m aware that in Drools you can use &#39;insert()&#39; in the &#39;then&#39; part of a rule to insert a new fact into the memory, meaning more rules may be fired based on the addition of this new fact. I wish to do a similar thing, but I wish to insert the fact into a specific entry point. My current rule code to do this is:<br>

<br><span style="color: rgb(51, 102, 255);">rule &quot;Allow message buyBook&quot;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">no-loop true</span><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">    when</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">        $event : MessageRecievedEvent(operationName == &quot;buyBook&quot;) from entry-point &quot;t1 stream&quot;</span><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">    then</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">        MessageRecievedEvent mre = new MessageRecievedEvent();</span><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">        mre.setOperationName(&quot;sellBook&quot;);</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">        StatefulKnowledgeSession session = kcontext.getKnowledgeRuntime().getKnowledgeBase().newStatefulKnowledgeSession();</span><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">        WorkingMemoryEntryPoint obStream = session.getWorkingMemoryEntryPoint(&quot;ob1 stream&quot;);</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">        obStream.insert(mre);</span><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">        session.fireAllRules();</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">end</span><br style="color: rgb(51, 102, 255);"><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">rule &quot;ob1&quot;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">no-loop true</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">    when</span><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">        $event : MessageRecievedEvent(operationName == &quot;sellBook&quot;) from entry-point &quot;ob1 stream&quot;</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">    then</span><br style="color: rgb(51, 102, 255);">

<span style="color: rgb(51, 102, 255);">        System.out.println(&quot;executed&quot;);</span><br style="color: rgb(51, 102, 255);"><span style="color: rgb(51, 102, 255);">end</span><br><br>Which is pretty hideous, but it does work, causing the second rule to fire after the first one. What I would like is something like:<br>

<br><span style="color: rgb(51, 102, 255);">rule &quot;Allow message buyBook&quot;</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">no-loop true</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">    when</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">        $event : MessageRecievedEvent(operationName == &quot;buyBook&quot;) from entry-point &quot;t1 stream&quot;</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">    then</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">        MessageRecievedEvent mre = new MessageRecievedEvent();</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">        mre.setOperationName(&quot;sellBook&quot;);</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">        <span style="color: rgb(255, 0, 0);">insert(mre, &quot;ob1 stream&quot;)</span></span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">end</span><br style="color: rgb(51, 102, 255);">
<br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">rule &quot;ob1&quot;</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">no-loop true</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">    when</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">        $event : MessageRecievedEvent(operationName == &quot;sellBook&quot;) from entry-point &quot;ob1 stream&quot;</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">    then</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">        System.out.println(&quot;executed&quot;);</span><br style="color: rgb(51, 102, 255);">
<span style="color: rgb(51, 102, 255);">end</span><br><br><font color="#000000">Is something like this possible or will I have to write a function to do it? I&#39;m also a bit concerned about the performance hit of creating a whole new StatefulKnowledgeSession to fire the second rule, I&#39;d like to just use the current one.<br>

<br>Thanks,<br><br>Justin<br></font>
<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>
<br></blockquote></div><br><br clear="all"><br>-- <br> - <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> - Salatino &quot;Salaboy&quot; Mauricio -<br>