[JBoss jBPM] - Re: How to best control access from multiple threads to a Pr
by kukeltje
Guys.... please...... how does a random incomming message know how to signal the process? You clearly do not state that. You say just signal the process. Your example demonstrates that this is what you think you will do. What is the advantage of having a process if any incoming message for that process instance can signal the process independent of the state it is in....
anonymous wrote : I had hoped that jBpm might have a clever way of achieving this without me having to write any code.It has, it's called the utopia feature.... now seriously... see my statement above. jBPM has no standard way to be able to service all different kinds of requirements.
What you have to build is a component that knows the relation between a state/task/node and an incomming message (e.g. via a task-name<->xsd mapping). An incomming message should trigger that code to look up a task with the corresponding name and signal that *task*, not the processinstance.
anonymous wrote : Presumably in this case jBpm has some mechanism to prevent multiple actors fulfilling the task.
It has... it's called assigning a task to an actor. Sure, you can circumvent this if you use a low level api. There will not be an access violation or anything if another actor does it, but that means *your* application provided a way to achieve this.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196969#4196969
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196969
15 years, 6 months
[JBoss jBPM] - Re: How to define a process definition that has multiples su
by faite
I changed the process definition
<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 to="process-state2"></transition>
| </node>
| <process-state name="process-state2">
| <sub-process name="processlistings"/>
| <transition to="join1"></transition>
| </process-state>
| <join name="join1">
| <transition to="end"></transition>
| </join>
| <end-state name="end"></end-state>
| </process-definition>
Action
*********
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]);
| }
| }
And I get this error
11:08:45,020 ERROR [GraphElement] action threw exception: can't create a process instance when processDefinition is null
| org.jbpm.JbpmException: can't create a process instance when processDefinition is null
| at org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:129)
| at org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:93)
| at org.jbpm.graph.exe.Token.createSubProcessInstance(Token.java:621)
| at org.jbpm.graph.node.ProcessState.execute(ProcessState.java:146)
| at org.jbpm.graph.def.Node.enter(Node.java:314)
| at sun.reflect.GeneratedMethodAccessor281.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
| at org.jbpm.graph.def.Node_$$_javassist_49.enter(Node_$$_javassist_49.java)
| at org.jbpm.graph.def.Transition.take(Transition.java:151)
| at org.jbpm.graph.def.Node.leave(Node.java:389)
| at com.ldg.bpm.handler.fork.ForEachForkActionHandler.execute(ForEachForkActionHandler.java:52)
Could you help me to fix this?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196925#4196925
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196925
15 years, 6 months