Using Split and Join would not execute the branches in different threads.<br><br><div class="gmail_quote">2010/4/26 rudolf michael <span dir="ltr">&lt;<a href="mailto:roudolf@gmail.com">roudolf@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">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 class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><font size="2" face="sans-serif">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 size="2" face="sans-serif">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 size="2" face="sans-serif">In order to achieve this, I&#39;ve done
the following:</font>
<br>
<br><font size="2" face="sans-serif">- Each process (both the main flow and
each sub flow) is executed by a separate stateful knowledge session.</font>
<br><font size="2" face="sans-serif">- When a sub flow is started, it inserts
a fact into the working memory of the session for the original process.</font>
<br><font size="2" face="sans-serif">- 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 size="2" face="sans-serif">- 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 size="2" face="sans-serif">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 size="2" face="sans-serif">(and forall(SimpleFact(complete == true))
exists(SimpleFact()))</font>
<br>
<br><font size="2" face="sans-serif">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 size="2" face="sans-serif">I still have two problems though:</font>
<br>
<br><font size="2" face="sans-serif">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 size="2" face="sans-serif">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 size="2" face="sans-serif">bitronix.tm.internal.BitronixRollbackException:
transaction was marked as rollback only and has been rolled back</font>
<br><font size="2" face="sans-serif">        at
bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:153)</font>
<br><font size="2" face="sans-serif">        at
bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:96)</font>
<br><font size="2" face="sans-serif">        at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:258)</font>
<br><font size="2" face="sans-serif">        at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.insert(CommandBasedStatefulKnowledgeSession.java:306)</font>
<br><font size="2" face="sans-serif">        at
com.test.InsertWorkItemHandler$1.insertFact(InsertWorkItemHandler.java:52)</font>
<br><font size="2" face="sans-serif">        at
com.test.InsertWorkItemHandler$1.run(InsertWorkItemHandler.java:40)</font>
<br><font size="2" face="sans-serif">        at
java.lang.Thread.run(Thread.java:619)</font>
<br><font size="2" face="sans-serif">java.lang.RuntimeException: Could not
rollback transaction</font>
<br><font size="2" face="sans-serif">        at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:283)</font>
<br><font size="2" face="sans-serif">        at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.insert(CommandBasedStatefulKnowledgeSession.java:306)</font>
<br><font size="2" face="sans-serif">        at
com.test.InsertWorkItemHandler$1.insertFact(InsertWorkItemHandler.java:52)</font>
<br><font size="2" face="sans-serif">        at
com.test.InsertWorkItemHandler$1.run(InsertWorkItemHandler.java:40)</font>
<br><font size="2" face="sans-serif">        at
java.lang.Thread.run(Thread.java:619)</font>
<br><font size="2" face="sans-serif">Caused by: java.lang.IllegalStateException:
no transaction started on this thread</font>
<br><font size="2" face="sans-serif">        at
bitronix.tm.BitronixTransactionManager.rollback(BitronixTransactionManager.java:103)</font>
<br><font size="2" face="sans-serif">        at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:278)</font>
<br><font size="2" face="sans-serif">        ...
4 more</font>
<p>
</p><p><font size="2" face="sans-serif">Any help anyone can provide would be
very much appreciated. Thank you.</font>
</p><p><font size="2" face="sans-serif">Regards,</font>
</p><p><font size="2" face="sans-serif">Alan</font>
</p><p>
<br>
<br>
<br>
</p><p></p><table width="100%">
<tbody><tr valign="top">
<td width="40%"><div><font size="1" face="sans-serif"><b>Pedro Maria Buitrago Mantilla
&lt;<a href="mailto:pmbtgun@gmail.com" target="_blank">pmbtgun@gmail.com</a>&gt;</b> </font>
<br></div><font size="1" face="sans-serif">Sent by: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a></font>
<p><font size="1" face="sans-serif">23/04/2010 14:38</font>
</p><table border="">
<tbody><tr valign="top">
<td bgcolor="white">
<div align="center"><font size="1" face="sans-serif">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 size="1" face="sans-serif">To</font></div>
</td><td><font size="1" face="sans-serif">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 size="1" face="sans-serif">cc</font></div>
</td><td>
</td></tr><tr valign="top">
<td>
<div align="right"><font size="1" face="sans-serif">Subject</font></div>
</td><td><font size="1" face="sans-serif">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 size="3" color="blue"><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 size="3" color="blue"><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 size="3" color="blue"><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 size="3" color="blue"><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 size="3" color="#8f8f8f"><br>
<br>
Pedro Buitrago<br>
<br>
</font><font size="3"><br>
</font>
<br><font size="3">_______________________________________________<br>
rules-users mailing list</font><font size="3" color="blue"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org" target="_blank"><font size="3" color="blue"><u>rules-users@lists.jboss.org</u></font></a><font size="3" color="blue"><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><font size="3" color="blue"><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 size="3" color="blue"><u>http://salaboy.wordpress.com</u></font></a><font size="3"><br>
- </font><a href="http://www.jbug.com.ar/" target="_blank"><font size="3" color="blue"><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 size="3" color="blue"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org" target="_blank"><font size="3" color="blue"><u>rules-users@lists.jboss.org</u></font></a><font size="3" color="blue"><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><font size="3" color="blue"><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 size="3" color="blue"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org" target="_blank"><font size="3" color="blue"><u>rules-users@lists.jboss.org</u></font></a><font size="3" color="blue"><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><font size="3" color="blue"><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 size="3" color="blue"><u>http://salaboy.wordpress.com</u></font></a><font size="3"><br>
- </font><a href="http://www.jbug.com.ar/" target="_blank"><font size="3" color="blue"><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 size="3" color="blue"><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org" target="_blank"><font size="3" color="blue"><u>rules-users@lists.jboss.org</u></font></a><font size="3" color="blue"><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><font size="3" color="blue"><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">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>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>