Input output mappings vs boundary events


#1

I have the following scenario:

  1. A service task that executes as a java delegate. It reads the variable “serviceIput” and writes (locally) the variable “serviceOutput”

  2. An input and output mapping that looks like this:

<camunda:inputOutput>
  <camunda:inputParameter name="serviceInput">${someVariable}</camunda:inputParameter>
  <camunda:outputParameter name="result">${serviceOutput}</camunda:outputParameter>
</camunda:inputOutput>
  1. A timer boundary event with duration PT10S to stop the service execution after 10 seconds.

My problem is that when the timer boundary is triggered, I get an incident with message:

Unknown property used in expression: ${serviceOutput}. Cause: Cannot resolve identifier ‘serviceOutput’

My guess is that the process engine is trying to execute the input/output mapping before moving to the next activity, and since the delegate hasn’t run, there is no serviceOutput variable set yet. How can I get arround this behavior to set a timeout on service tasks with input/output mappings?


Output mapping on intermediate message catch event i.c.w. terminate event
#2

Hi @carlosjourdan,

currently, you can’t disable the behavior. That means that the process engine will always try to execute the output mappings. One way to handle this is to set the variable via ExecutionListener which can check if the outcome is available.

I understand that this is not so handy. Do you want to work on a feature request to improve the situation?

Best regards,
Philipp


#3

Hi @Philipp_Ossler,

I’ll put up feature request, but I confess I’m a little unsure weather this should apply to all boundary events indiscriminately.

Anyways, thanks for the suggestion, but I ended up stumbling upon a simple workarround: if I change the mapping from ${myVariable} to ${execution.getVariable('myVariable')} the mapping will execute but won’t fail if myVariable doesn’t exist.

Cheers