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:

<dataInputAssociation>
        <sourceRef>messages</sourceRef>
        <targetRef>_5_internalMessagesInput</targetRef>
</dataInputAssociation>

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:


<dataOutputAssociation>
        <sourceRef>_5_internalMessagesOutput</sourceRef>
        <targetRef>messages</targetRef>
</dataOutputAssociation>

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
[http://community.jboss.org/message/610791#610791]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to