<div dir="ltr">Thank you in advance.</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-04 18:29 GMT+02:00 Charles Moulliard <span dir="ltr">&lt;<a href="mailto:ch007m@gmail.com" target="_blank">ch007m@gmail.com</a>&gt;</span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I will have a look to your use case as it is not yet covered and will perhaps require that we modify the kie-camel component</div>
<div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Wed, Jun 4, 2014 at 6:02 PM, s b <span dir="ltr">&lt;<a href="mailto:scerquido@gmail.com" target="_blank">scerquido@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div><div><div><div><div>I&#39;m testing the drools new version (6.1.0.Beta4) but I have a problem with the Stateful Drools Session.<br>

<br></div>I have deployed in JBoss Fuse ESB the last versión of the drools (drools camel, jbpm, spring, etc), I have atached my camel context bundle (It&#39;s a maven project). <br>
<br></div>This is my camel-context<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;beans xmlns=&quot;<a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a>&quot;<br>


       xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>&quot;<br>       xmlns:kie=&quot;<a href="http://drools.org/schema/kie-spring" target="_blank">http://drools.org/schema/kie-spring</a>&quot;<br>


       xsi:schemaLocation=&quot;<br>       <a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a> <br>       <a href="http://www.springframework.org/schema/beans/spring-beans-3.0.xsd" target="_blank">http://www.springframework.org/schema/beans/spring-beans-3.0.xsd</a><br>


       <a href="http://drools.org/schema/kie-spring" target="_blank">http://drools.org/schema/kie-spring</a> <a href="http://drools.org/schema/kie-spring.xsd" target="_blank">http://drools.org/schema/kie-spring.xsd</a><br>

       <a href="http://camel.apache.org/schema/spring" target="_blank">http://camel.apache.org/schema/spring</a> <a href="http://camel.apache.org/schema/spring/camel-spring.xsd" target="_blank">http://camel.apache.org/schema/spring/camel-spring.xsd</a>&quot;&gt;<br>


       <br>        <br>    <br> &lt;kie:kmodule id=&quot;kModule&quot;&gt;<br>        &lt;kie:kbase name=&quot;rules&quot; packages=&quot;rules&quot;&gt;<br>            &lt;kie:ksession name=&quot;ksession1&quot; type=&quot;stateful&quot;&gt;    <br>


            &lt;!--&lt;kie:batch&gt;<br>               &lt;kie:fire-all-rules/&gt;<br>               &lt;/kie:batch&gt; --&gt;            <br>            &lt;kie:configuration&gt;<br>                &lt;kie:jpa-persistence&gt;<br>


                    &lt;kie:transaction-manager ref=&quot;txManager&quot;/&gt;<br>                    &lt;kie:entity-manager-factory ref=&quot;myEmf&quot;/&gt;<br>                &lt;/kie:jpa-persistence&gt;                <br>


            &lt;/kie:configuration&gt;<br>            <br>            <br>            &lt;/kie:ksession&gt;<br>        &lt;/kie:kbase&gt;<br>    &lt;/kie:kmodule&gt;<br><br>    &lt;kie:environment id=&quot;env&quot;&gt;<br>


       &lt;kie:entity-manager-factory ref=&quot;myEmf&quot;/&gt;<br>        &lt;kie:transaction-manager ref=&quot;txManager&quot;/&gt;<br>    &lt;/kie:environment&gt;<br><br>  <br>  &lt;bean class=&quot;org.postgresql.ds.PGPoolingDataSource&quot; id=&quot;jbpm-ds&quot;&gt;<br>


   &lt;property name=&quot;serverName&quot; value=&quot;localhost&quot;&gt;&lt;/property&gt;<br>   &lt;property name=&quot;databaseName&quot; value=&quot;drools&quot;&gt;&lt;/property&gt;<br>   &lt;property name=&quot;portNumber&quot; value=&quot;5432&quot;&gt;&lt;/property&gt;<br>


   &lt;property name=&quot;user&quot; value=&quot;DWP&quot;&gt;&lt;/property&gt;<br>   &lt;property name=&quot;password&quot; value=&quot;DWP&quot;&gt;&lt;/property&gt;<br>  &lt;/bean&gt;<br>  <br>    <br>    &lt;bean id=&quot;myEmf&quot; class=&quot;org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean&quot;&gt;<br>


        &lt;property name=&quot;dataSource&quot; ref=&quot;jbpm-ds&quot;/&gt;<br>        &lt;property name=&quot;persistenceUnitName&quot; value=&quot;org.jbpm.persistence.jpa.local&quot;/&gt;<br>    &lt;/bean&gt;<br><br>


    &lt;bean id=&quot;txManager&quot; class=&quot;org.springframework.orm.jpa.JpaTransactionManager&quot;&gt;<br>        &lt;property name=&quot;entityManagerFactory&quot; ref=&quot;myEmf&quot;/&gt;<br>    &lt;/bean&gt;<br>


<br>    &lt;bean id=&quot;kiePostProcessor&quot; class=&quot;org.drools.osgi.spring.OsgiKModuleBeanFactoryPostProcessor&quot;/&gt;<br><br>    &lt;bean id=&quot;fireALlRulesCommand&quot; class=&quot;com.execute.command.FireAllRules&quot;/&gt;<br>


    <br>  &lt;camelContext xmlns=&quot;<a href="http://camel.apache.org/schema/spring" target="_blank">http://camel.apache.org/schema/spring</a>&quot;&gt;<br>    &lt;route trace=&quot;false&quot; id=&quot;testRoute&quot;&gt;<br>

        &lt;from uri=&quot;timer:testRoute?period=10s&quot;/&gt;<br>
         &lt;to uri=&quot;log:message&quot;/&gt;<br>         &lt;to uri=&quot;kie:ksession1?action=insertBody&quot; id=&quot;AgeVerification&quot;/&gt;<br>          <br>         &lt;bean method=&quot;fireAllRules&quot; ref=&quot;fireALlRulesCommand&quot;/&gt; <br>


         &lt;to uri=&quot;kie:ksession1?action=execute&quot;/&gt;<br>        <br>    &lt;/route&gt;<br>  &lt;/camelContext&gt; <br>    <br>&lt;/beans&gt;<br><br></div>As you can see it is an scenario where Drools is in an stateful session with persistence configured. <br>


<br>The bundle is executed without errors but I want that Drools executes my rules each time that the route is executed ( fireUntilHalt mode but I wasn&#39;t able as seems that this command is not availble in a persisted environment ), for this reason I&#39;ve created a bean with the command: fireAllRules and I use &lt;to uri=&quot;kie:ksession1?action=execute&quot;/&gt; to execute the rules but the problem is that the rules are only executed the first time, only the first time and never in subsequents executions of the route.<br>


<br> The persistece seems to  work well ( I can see the datamodel created and populated as expeted in the DB ). <br><br>However if I change to use stateless mode  ( no persistence then ), the rules are executed each time that route is executed ( as expected ), and therefore I don´t need the command fireAllRules<br>


&lt;bean method=&quot;fireAllRules&quot; ref=&quot;fireALlRulesCommand&quot;/&gt; <br> &lt;to uri=&quot;kie:ksession1?action=execute&quot;/&gt;<br><br><br><br></div>Questions:<br><br></div>Is it possible to have a stateful fireUntilHalt drools session that keeps using the same knowledge session in subsequent camel route executions?<br>


<br></div>If it is not possible, Can I have a stateful ( persisted )drools session and invoke &quot;fireAllRules&quot; whenever I make changes in the knowledge session ( new Facts are inserted )?<br><br></div>I&#39;ve deep dived into the web looking for examples or documentation of this scenario both in Spring and Blueprint. Does anyone of you have any pointers to documentation on the matter?<br>


<br></div>Kind Regards,<br></div>
<br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><span class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br>
<br clear="all"><div><br></div>-- <br><div dir="ltr"><div>
Charles Moulliard</div><div>Apache Committer / Architect @RedHat</div><div>Twitter : @cmoulliard | Blog : <a href="http://cmoulliard.github.io" target="_blank"> http://cmoulliard.github.io</a></div><div><br></div></div>
</font></span></div>
<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></div>