it&#39;s not a problem really..<br><br><div class="gmail_quote">2010/4/26 Pedro Maria Buitrago Mantilla <span dir="ltr">&lt;<a href="mailto:pmbtgun@gmail.com">pmbtgun@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>The problem is the multithreading execution. For a &quot;SPLIT NODE&quot; of type &quot;AND&quot;, first, is process one branch, after, the next branch and so on for each. The execution is sequential.<br><br clear="all">


PEDRO MARIA BUITRAGO MANTILLA<br>Bogotá, Colombia<br><br>
<br><br><div class="gmail_quote">2010/4/26 rudolf michael <span dir="ltr">&lt;<a href="mailto:roudolf@gmail.com" target="_blank">roudolf@gmail.com</a>&gt;</span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div dir="ltr">Alan, couldn&#39;t you have achieved this using a Split and Join?<br><br><div class="gmail_quote">2010/4/26  <span dir="ltr">&lt;<a href="mailto:Alan.Gairey@tessella.com" target="_blank">Alan.Gairey@tessella.com</a>&gt;</span><div>


<div></div><div><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><font face="sans-serif" size="2">Interesting. What you&#39;ve described Pedro
is similar to what I&#39;m trying to achieve, and also relates to some earlier
posts I made to the list (title: &#39;Drools Flow: Problem with constraint
in (Wait) State node&#39;).<br>
</font>
<br><font face="sans-serif" size="2">I have a process that launches independent
sub flows; these independent sub flows execute on separate threads. I then
want the original process to &quot;block&quot; until all the subflows have
finished, and to then continue.</font>
<br><font face="sans-serif" size="2">In order to achieve this, I&#39;ve done
the following:</font>
<br>
<br><font face="sans-serif" size="2">- Each process (both the main flow and
each sub flow) is executed by a separate stateful knowledge session.</font>
<br><font face="sans-serif" size="2">- When a sub flow is started, it inserts
a fact into the working memory of the session for the original process.</font>
<br><font face="sans-serif" size="2">- When a sub flow finishes, it updates
a fact in the working memory of the session for the original process to
&quot;signal&quot; its completion.</font>
<br><font face="sans-serif" size="2">- After launching the sub flows, the
original process contains a (wait) state node; the constraint for this
node is designed to block until all facts in its memory are in the &quot;signalled&quot;
state.</font>
<br>
<br><font face="sans-serif" size="2">I&#39;ve attached an example project that
illustrates what I&#39;m trying to achieve. The constraint on the wait state
node is currently as follows:</font>
<br>
<br><font face="sans-serif" size="2">(and forall(SimpleFact(complete == true))
exists(SimpleFact()))</font>
<br>
<br><font face="sans-serif" size="2">I&#39;d be interested to know from someone
who understands rule syntax better than me as to why this seems to work
when other attempts (see my earlier posts) failed.</font>
<br>
<br><font face="sans-serif" size="2">I still have two problems though:</font>
<br>
<br><font face="sans-serif" size="2">1) The above constraint appeared to
work OK with an earlier 5.1 snapshot build (from a couple of months back).
However, using the latest successful build from trunk (#3845), the Action
node after the wait state node isn&#39;t executed. Given that 5.1.M2 is supposed
to be imminent, I&#39;m worried. Does anyone know why this no longer works?</font>
<br>
<br><font face="sans-serif" size="2">2) If I try to enable JPA-based state
persistence, using the Bitronix transaction manager, then when I try to
insert a fact into the  working memory of the session for the original
process from a separate thread, I get the following error:</font>
<br>
<br><font face="sans-serif" size="2">bitronix.tm.internal.BitronixRollbackException:
transaction was marked as rollback only and has been rolled back</font>
<br><font face="sans-serif" size="2">        at
bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:153)</font>
<br><font face="sans-serif" size="2">        at
bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:96)</font>
<br><font face="sans-serif" size="2">        at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:258)</font>
<br><font face="sans-serif" size="2">        at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.insert(CommandBasedStatefulKnowledgeSession.java:306)</font>
<br><font face="sans-serif" size="2">        at
com.test.InsertWorkItemHandler$1.insertFact(InsertWorkItemHandler.java:52)</font>
<br><font face="sans-serif" size="2">        at
com.test.InsertWorkItemHandler$1.run(InsertWorkItemHandler.java:40)</font>
<br><font face="sans-serif" size="2">        at
java.lang.Thread.run(Thread.java:619)</font>
<br><font face="sans-serif" size="2">java.lang.RuntimeException: Could not
rollback transaction</font>
<br><font face="sans-serif" size="2">        at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:283)</font>
<br><font face="sans-serif" size="2">        at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.insert(CommandBasedStatefulKnowledgeSession.java:306)</font>
<br><font face="sans-serif" size="2">        at
com.test.InsertWorkItemHandler$1.insertFact(InsertWorkItemHandler.java:52)</font>
<br><font face="sans-serif" size="2">        at
com.test.InsertWorkItemHandler$1.run(InsertWorkItemHandler.java:40)</font>
<br><font face="sans-serif" size="2">        at
java.lang.Thread.run(Thread.java:619)</font>
<br><font face="sans-serif" size="2">Caused by: java.lang.IllegalStateException:
no transaction started on this thread</font>
<br><font face="sans-serif" size="2">        at
bitronix.tm.BitronixTransactionManager.rollback(BitronixTransactionManager.java:103)</font>
<br><font face="sans-serif" size="2">        at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:278)</font>
<br><font face="sans-serif" size="2">        ...
4 more</font>
<p>
</p><p><font face="sans-serif" size="2">Any help anyone can provide would be
very much appreciated. Thank you.</font>
</p><p><font face="sans-serif" size="2">Regards,</font>
</p><p><font face="sans-serif" size="2">Alan</font>
</p><p>
<br>
<br>
<br>
</p><p></p><table width="100%">
<tbody><tr valign="top">
<td width="40%"><div><font face="sans-serif" size="1"><b>Pedro Maria Buitrago Mantilla
&lt;<a href="mailto:pmbtgun@gmail.com" target="_blank">pmbtgun@gmail.com</a>&gt;</b> </font>
<br></div><font face="sans-serif" size="1">Sent by: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a></font>
<p><font face="sans-serif" size="1">23/04/2010 14:38</font>
</p><table border="1">
<tbody><tr valign="top">
<td bgcolor="white">
<div align="center"><font face="sans-serif" size="1">Please respond to<br>
Rules Users List &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;</font></div></td></tr></tbody></table>
<br>
</td><td width="59%">
<table width="100%">
<tbody><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">To</font></div>
</td><td><font face="sans-serif" size="1">Rules Users List &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;</font>
</td></tr><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">cc</font></div>
</td><td>
</td></tr><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">Subject</font></div>
</td><td><font face="sans-serif" size="1">Re: [rules-users] Multithreading work
items</font></td></tr></tbody></table>
<br>
<table>
<tbody><tr valign="top">
<td>
</td><td></td></tr></tbody></table>
<br></td></tr></tbody></table><div><div></div><div>
<br>
<br>
<br><font size="3">Each of the sub flows requires final user design. Mauricio
thanks very much. </font>
<br><font size="3"><br>
PEDRO BUITRAGO<br>
Bogotá, Colombia<br>
<br>
</font>
<br><font size="3">2010/4/22 Mauricio Salatino &lt;</font><a href="mailto:salaboy@gmail.com" target="_blank"><font color="blue" size="3"><u>salaboy@gmail.com</u></font></a><font size="3">&gt;</font>
<br><font size="3">yes.. sounds more like a normal java problem than Drools
FLow problem. I think that your solution is the correct one because it
handle internally the multithreaded requierements and then it continue
the business process normally.<br>
<br>
</font>
<br><font size="3">2010/4/22 Pedro Maria Buitrago Mantilla &lt;</font><a href="mailto:pmbtgun@gmail.com" target="_blank"><font color="blue" size="3"><u>pmbtgun@gmail.com</u></font></a><font size="3">&gt;
</font>
<br>
<br><font size="3">The idea is to run multiple independent sub flows. Each
of the sub flows requires approximately 2 minutes to complete, so parallel
processing is required. Once all the sub flows have completed their tasks
is necessary to collect all the results and process them. This implies
that the workflow should not end until it collects all information submitted
by the sub flows.<br>
<br>
For now, I think to create, with JMS, a queue in jboss receive the name
of each sub flow, create your own KnowledgeBase run each subflow as a separate
workflow and delivers the results. Finally, some components will take all
the results (from a database of another jms queue and process and again
another component start another workflow to process all results.<br>
<br>
<br>
PEDRO BUITRAGO<br>
Bogotá, Colombia<br>
<br>
</font>
<br><font size="3">2010/4/22 Mauricio Salatino &lt;</font><a href="mailto:salaboy@gmail.com" target="_blank"><font color="blue" size="3"><u>salaboy@gmail.com</u></font></a><font size="3">&gt;
</font>
<br>
<br><font size="3">can you describe a little bit your use case?<br>
I&#39;m not sure about what you want to achieve.<br>
</font>
<br><font size="3">2010/4/21 Pedro Maria Buitrago Mantilla &lt;</font><a href="mailto:pmbtgun@gmail.com" target="_blank"><font color="blue" size="3"><u>pmbtgun@gmail.com</u></font></a><font size="3">&gt;</font>
<br><font size="3">In general, I meet that for resolve the topic of multithreading
it&#39;s required to implement another thread over a work item.<br>
<br>
How does the asynchronic task  can modified a variable of Knowledgebase?<br>
<br>
Can you give me an example?</font><font color="#8f8f8f" size="3"><br>
<br>
Pedro Buitrago<br>
<br>
</font><font size="3"><br>
</font>
<br><font size="3">_______________________________________________<br>
rules-users mailing list</font><font color="blue" size="3"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org" target="_blank"><font color="blue" size="3"><u>rules-users@lists.jboss.org</u></font></a><font color="blue" size="3"><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><font color="blue" size="3"><u>https://lists.jboss.org/mailman/listinfo/rules-users</u></font></a><font size="3"><br>
</font>
<br><font size="3"><br>
<br>
<br>
-- <br>
- </font><a href="http://salaboy.wordpress.com/" target="_blank"><font color="blue" size="3"><u>http://salaboy.wordpress.com</u></font></a><font size="3"><br>
- </font><a href="http://www.jbug.com.ar/" target="_blank"><font color="blue" size="3"><u>http://www.jbug.com.ar</u></font></a><font size="3"><br>
- Salatino &quot;Salaboy&quot; Mauricio -</font>
<br><font size="3"><br>
_______________________________________________<br>
rules-users mailing list</font><font color="blue" size="3"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org" target="_blank"><font color="blue" size="3"><u>rules-users@lists.jboss.org</u></font></a><font color="blue" size="3"><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><font color="blue" size="3"><u>https://lists.jboss.org/mailman/listinfo/rules-users</u></font></a><font size="3"><br>
</font>
<br><font size="3"><br>
<br>
_______________________________________________<br>
rules-users mailing list</font><font color="blue" size="3"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org" target="_blank"><font color="blue" size="3"><u>rules-users@lists.jboss.org</u></font></a><font color="blue" size="3"><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><font color="blue" size="3"><u>https://lists.jboss.org/mailman/listinfo/rules-users</u></font></a><font size="3"><br>
</font>
<br><font size="3"><br>
<br>
<br>
-- <br>
- </font><a href="http://salaboy.wordpress.com/" target="_blank"><font color="blue" size="3"><u>http://salaboy.wordpress.com</u></font></a><font size="3"><br>
- </font><a href="http://www.jbug.com.ar/" target="_blank"><font color="blue" size="3"><u>http://www.jbug.com.ar</u></font></a><font size="3"><br>
- Salatino &quot;Salaboy&quot; Mauricio -</font>
<br><font size="3"><br>
_______________________________________________<br>
rules-users mailing list</font><font color="blue" size="3"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org" target="_blank"><font color="blue" size="3"><u>rules-users@lists.jboss.org</u></font></a><font color="blue" size="3"><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><font color="blue" size="3"><u>https://lists.jboss.org/mailman/listinfo/rules-users</u></font></a><font size="3"><br>
</font>
<br><tt><font size="2">_______________________________________________<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><br>
</font></tt>
<br></div></div><p></p><p></p><p></p><p></p><p></p><br>_______________________________________________<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><br>
<br></blockquote></div></div></div><br></div>
<br>_______________________________________________<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><br>
<br></blockquote></div></div></div><br>
<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>