JBPM 3.2.2 SubProcess Woes

I’m trying to create a subprocess in JBPM 3.2.2, but the variable management in the JBPM framework is finicky. What I found was in some situations, JBPM will not copy a super process’s transient variables into its subprocess’s transient variable map.

Here’s an example of a process-state defined in the super process:

<process-definition name="SuperProcess">
  <start-state>
    <transition to="SubProcess State" />
  </start-state>
  <process-state name="SubProcess State">
    <sub-process name="SubProcess" />
    <transition to="A SuperProcess Node" />
  </process-state>
  ...
</process-definition>

I started up the debugger, and did a little investigation. My transient variable map for my subprocess is empty when I am exercising my subprocess.

What I found is that JBPM will only copy a super process’s transient variables to a subprocess if you define a persistent variable to copy into the subprocess in the XML descriptor.

This is bizarre, since I don’t want to copy any persistent variables over to the subprocess.

So now my xml descriptor looks like this:

<process-definition name="SuperProcess">
  <start-state>
    <transition to="SubProcess State" />
  </start-state>
  <process-state name="SubProcess State">
    <sub-process name="SubProcess" />
    <variable name="A variable" access="read" />
    <transition to="A SuperProcess Node" />
  </process-state>
  ...
</process-definition>

JBPM will then copy all the transient variables from the super process into the subprocess’s transient variable map, using the same names. My fake persistent variable is safely ignored by JPBM.

So everything works, except for I can’t give the transient variable an alias within in the subprocess, which is a bit unfortunate since I plan for my subprocess to be reusable by other super processes. JBPM lets you define aliases for persistent variables by the mapped-name property but no element exists for defining transient variables.

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply