[jboss-user] [jBPM] - Re: How does a sub-process work?

Esteban Aliverti do-not-reply at jboss.com
Fri Jun 17 09:12:15 EDT 2011

Esteban Aliverti [http://community.jboss.org/people/eaa] created the discussion

"Re: How does a sub-process work?"

To view the discussion, visit: http://community.jboss.org/message/610791#610791

Be careful! In your example, you are working with the process instance and not the session. So kcontext.*getKnowledgeRuntime*() will return the same StatefullKnowledgeSession in both of your processes. But, kcontext.*getProcessInstance*() will return different process instances of course (one is the main process and the other one is the sub-process).
>From your tests I assume you are talking about process variables. Process variables only exist in the context of the process instance. So, if you want to usa a variable from your main process in your sub-process, you need to do the mappings in the reusable-subprocess node.
For example, in the test I have provided to you, I'm declaring a variable (messages) in the parent process:

<property id="messages" itemSubjectRef="_messagesItem"/>

Because I want to use this variable in my sub-process, I need to declare a variable of the same type in it:

<property id="internalMessages" itemSubjectRef="_internalMessagesItem"/>

 Then, in the reusable-subprocess node (in the paren process) I need to copy the value from messages to internalMessages:


And because I need to use the modified value of this variable in my parent process once the sub-process is finished, I also need to do an output mapping:


Of course you can use eclipse editor to do all these things in a more user-friendly way  :) 

Best Regards,

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110617/33761aa5/attachment.html 

More information about the jboss-user mailing list