[JBoss jBPM] - Re: How to define a process definition that has multiples su
by faite
I made the next changes but it don't work, it don't stop at the join node.
Any ideas how to fix this?
Thanks
public class ForEachForkActionHandler implements ActionHandler
| {
| private static final long serialVersionUID = 1L;
| protected static final String FOREACH_PREFIX = "foreach.";
|
| /**
| * Create a new child token for each item in list.
| *
| * @param executionContext
| * @throws Exception
| */
| public void execute(final ExecutionContext executionContext) throws Exception
| {
| final Token rootToken = executionContext.getToken();
| final Node node = executionContext.getNode();
| final List argSets = new LinkedList();
|
| for (int i = 0; i < node.getLeavingTransitions().size(); i++) {
| final Transition transition = (Transition) node.getLeavingTransitions().get(0);
|
| for (int j = 0; j < 2; j++) {
|
| final Token newToken = new Token(rootToken, FOREACH_PREFIX + node.getId() + "." + j);
| newToken.setTerminationImplicit(true);
| executionContext.getJbpmContext().getSession().save(newToken);
|
| final ExecutionContext newExecutionContext = new ExecutionContext( newToken );
| newExecutionContext.getContextInstance().createVariable( "message", "data " + j, newToken);
| argSets.add(new Object[] {newExecutionContext, transition});
| }
| }
|
| for (int i = 0; i < argSets.size(); i++)
| {
| final Object[] args = (Object[]) argSets.get(i);
| node.leave((ExecutionContext) args[0], (Transition) args[1]);
| }
| }
|
| }
|
|
| <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="listingloads">
| <start-state name="load new file">
| <transition to="fork1">
| </transition>
| </start-state>
| <node name="fork1">
| <action class="com.ldg.bpm.handler.fork.ForEachForkActionHandler">
| </action>
| <transition name="subprocess" to="process-state1"></transition>
| </node>
| <node name="process-state1">
| <transition to="join1"></transition>
| </node>
| <join name="join1">
| <transition to="end"></transition>
| </join>
| <end-state name="end"></end-state>
| </process-definition>
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196680#4196680
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196680
15 years, 6 months
[JBoss jBPM] - How to best control access from multiple threads to a Proces
by jse
I have a workflow that interacts with some deeply asynchronous external systems. These systems send messages to my system and the receipt of each message is handled by its own thread. On receipt of a message, the thread needs to signal the process instance associated with the message to move it out of its wait state to the next state.
The issue is that the process instance may still be processing a previous message... and that multiple messagess may arrive and these should be used to signal the process instance in time arrival order.
Is there a way of "working with the grain" of jBpm to accomplish what is essentially queuing access to to a process instance, only allowing a thread to signal when the instance is not in use by another thread? ... or do I need to implement infrastructure external to jBpm based on something like JMS?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196678#4196678
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196678
15 years, 6 months