<div dir="ltr">just basic Drools 5.5.0 Final<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 14, 2013 at 8:40 PM, Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Which Drools version do you use?<br>
<div class="HOEnZb"><div class="h5"><br>
On 14/07/2013, k &lt;<a href="mailto:rrdh@gmx.net">rrdh@gmx.net</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt; basically it&#39;s the same problem this guy had<br>
&gt; <a href="http://stackoverflow.com/questions/11485122/non-template-dynamic-rules-in-drools" target="_blank">http://stackoverflow.com/questions/11485122/non-template-dynamic-rules-in-drools</a><br>
&gt; &lt;<a href="http://stackoverflow.com/questions/11485122/non-template-dynamic-rules-in-drools" target="_blank">http://stackoverflow.com/questions/11485122/non-template-dynamic-rules-in-drools</a>&gt;<br>
&gt;<br>
&gt; , but the links in that question don&#39;t work.<br>
&gt;<br>
&gt; I&#39;d like to dynamically add rules to a running session, but can use &#39;eval&#39;<br>
&gt; only in the very first one. If I add a second rule like the following, it<br>
&gt; won&#39;t execute:<br>
&gt;<br>
&gt; ---<br>
&gt;<br>
&gt; String test2 =<br>
&gt;   &quot;\nrule id4&quot; +<br>
&gt;   &quot;\nwhen&quot; +<br>
&gt;   &quot;\neval(0 == 0)&quot; + // if this eval is removed, &quot;done2&quot; is inserted<br>
&gt;   &quot;\nthen&quot; +<br>
&gt;   &quot;\ninsertLogical( \&quot;done2\&quot; );&quot; +<br>
&gt;   &quot;\nend&quot;;<br>
&gt;<br>
&gt; kbuilder.add(ResourceFactory.newByteArrayResource(test2.getBytes()),<br>
&gt; ResourceType.DRL);<br>
&gt; session.getKnowledgeBase().addKnowledgePackages(kbuilder.getKnowledgePackages());<br>
&gt;<br>
&gt; fired = session.fireAllRules();<br>
&gt; System.out.println(fired); // 0<br>
&gt; effects = session.getObjects();<br>
&gt; assertTrue(&quot;fired&quot;, effects.contains(&quot;done2&quot;)); // fails<br>
&gt;<br>
&gt; ---<br>
&gt;<br>
&gt; You can see the complete Test at <a href="http://codetidy.com/6206/" target="_blank">http://codetidy.com/6206/</a><br>
&gt;<br>
&gt; I&#39;m also not sure if this is the correct way to dynamically add rules, so<br>
&gt; please let me know, if there&#39;s a better way to add rules from strings.<br>
&gt;<br>
&gt; How can I dynamically add new rules to a running session and still use<br>
&gt; eval?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context:<br>
&gt; <a href="http://drools.46999.n3.nabble.com/Dynamic-Rules-and-Eval-tp4024908.html" target="_blank">http://drools.46999.n3.nabble.com/Dynamic-Rules-and-Eval-tp4024908.html</a><br>
&gt; Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<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>
</div></div></blockquote></div><br></div>