[JBoss jBPM] - task node does not have leaving transition
by mitabhushan
I have a jBPM Task with two tranisition
| <task-node name="QuoteApproval" end-tasks="true">
| <task name="QuoteApprove">
| <description>
| Approve/Reject the Quote
| </description>
| <assignment actor-id="#{inquireHome.instance.salesRepEmail}"/>
| </task>
| <transition to="CreateOrder" name="toCreateOrder"></transition>
| <transition to="RejectedRequest" name="toRejectedRequest"></transition>
| </task-node>
|
if I have a transition name mentioned on the EndTask I get an error "javax.ejb.EJBTransactionRolledbackException: task node does not have leaving transition 'toCreateOrder'".
It works fine when no transition name is mentioned.
Below code works fine
| @EndTask
| public String updateQuote()
| {
| return "closeRequest";
| }
|
EndTask with Transition name doesnot work
| @EndTask(transition="toCreateOrder")
| public String updateQuote()
| {
| return "closeRequest";
| }
|
|
Any Ideas!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206272#4206272
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206272
16 years
[JBoss jBPM] - Re: Dynamic Fork + External Async WS invocation + problem
by clandestino_bgd
Hi, 1st, thanks for looking into this.
process looks like this: S-F-T-J-E
S: Start state,
D: Dynamic Fork (based on WF variable creates N new tokens),
T: Task Node (on create has Action Handler that calls WS), Task ends when WS make a callback, child tokens wait in
J: Join.
E: End state
- NPE in callback method:
| JbpmTaskInstance taskInstance = (JbpmTaskInstance) context.getTaskInstance(taskInstanceId);
| log.debug("documentId: " + taskInstance.getDocumentId());
|
context.getTaskInstance() returns null, nothing particulary intersesting in stacktrace, simply task instance with that ID cannot be found neither in context nor in DB in that moment.
My understanding of the subject, and please correct me if I am wrong is that in Dynamic Fork which looks like this:
| for (int i = 0; i < numberOfDocuments; i++) {
| String documentId = documentList.get(i);
| // build a new token name
| String tokenName = JPDLConstants.DOCUMENT_PREFIX+ documentId;
| final Token newToken = new Token(rootToken, tokenName);
| newToken.setTerminationImplicit(true);
| context.getJbpmContext().getSession().save(newToken);
| final ExecutionContext newExecutionContext = new ExecutionContext(newToken);
| newExecutionContext.getJbpmContext().getSession().save(newToken);
| node.leave(newExecutionContext);
| }
|
after new ExecutionContext is constructed and node.leave(context) is called for Token #1, the task instance in that token is created, action handler is invoked and then the next token is processed in for loop, but task instance is still not persisted in DB physically.
What I would like to have is when I call this action handler and WS in it, to be able to save that task instance in DB, so callback method can find it immediately.
As far as I know, the default behavior is to propagate execution in ALL outgoing paths, until the wait state is reached in all of the child tokens and then to persist everything in DB.
Making task node async does not remove the problem.
Again as far as I understand async continuations, you just spawn another thread but it does not commit stuff in DB. In other words, in both cases (regular or async task node). task instances will not be created in DB until all of them are not created, and that will happen when all child token paths are calculated while leaving Fork node.
Is this a nonsense? if yes, please help me understand.
Btw, It is completely clear that this problem is not related to WS, but to any async invocation.
Thank you for any hint/idea/comment/question.
milan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206226#4206226
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206226
16 years
[JBoss jBPM] - Dynamic Fork + External Async WS invocation + problem
by clandestino_bgd
Hi people, in short:
My Process:
Just after Start state, I have dynamic fork (Action Handler defined on Node, very similar to the one on wiki). In each child I have a Task node, on which event (task-create) I have an ActionHandler which invokes WS asynchronously, by passing taskInstanceId as parameter.
When WS finishes the operation, it invokes callback method which ends the task instance.
And the problem:
When I start the process instance, if I have a significant number of children, it happens that the 1st WS does the callback before all child tokens are generated, which results in NPE when I try to get task instance in callback method.
Ok, seems, that new tokens and created task instances are not persisted in DB, but only in memory and this is according to docs, but can I somehow change the default behavior and support the described scenario?
Or maybe somebody has an idea how to support "concurrent" WS invocations without explicitely call to each of them?
Retrying callback or WS timeout can fix the problem, but this is configurable on WS side, not JBPM.
Any idea, much appreciated.
best,
milan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206146#4206146
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206146
16 years