cancel
Showing results for 
Search instead for 
Did you mean: 

Output variables from CallActivity on BoundaryEvent trigger?

jonathan1
Champ in-the-making
Champ in-the-making
I have a call activity publishing an exit-code variable.  The call activity also has a boundary error event associated with it. 

After triggering the boundary event, I'd like to read the published exit-code variable in the parent process, but tracing the Activiti Engine, it appears that handling the boundary event preempts publishing the call activity's internal exit-code variable to the output variable, so the output variable isn't pushed out to the parent (it is set in the child process, looking at the DB).

Is there a way to ensure that the parent process can read a variable from it's child call activity in the event a boundary event is triggered?
24 REPLIES 24

smirzai
Champ on-the-rise
Champ on-the-rise
Comment from Tijs:
We are not a big fan of the BPMN data input and output definition.
So this will definitely need a lot more discussion.
Because we are now finalising the source code to the 5.11 release I would ask to let this one rest to after the release.
Then we can startup a discussion about it.

smirzai
Champ on-the-rise
Champ on-the-rise
Hi Tijs
I also think it is better to be implemented with the new version of parser. I will reopen the issue after release of 5.11.

smirzai
Champ on-the-rise
Champ on-the-rise
From Tijs:

Hi Saeid,

Yes we can do that now. I think we need a similar definition as the call activity to define the payload of the error message.
In the case of an error end event we only need an output definition.
As I said before we don't like the BPMN itemdefinition approach so I would like to keep it similar to the current call activity input and output definitions.

smirzai
Champ on-the-rise
Champ on-the-rise
Hi Tijs:
Do you mean something from BPMN standard or some activiti specific extension ?
Can you suggest an hypothetical  xml sample ?

trademak
Star Contributor
Star Contributor
Hi Saeid,

Will have to think a bit about that one. I'll come back to this tomorrow.

Best regards,

trademak
Star Contributor
Star Contributor
Hi,

If we could add a Map to the BpmnError then we have a container to add variables.
The error event definition could something like this:

<blockcode>
<errorEventDefinition errorRef="myError">
  <extensionElements>
    <activiti:variable name="customerNr" />
    <activiti:variable expression="${customer.name}" />
  </extensionElements>
</errorEventDefinition>
</blockcode>

Do you think this would be a good way to define the payload of the BpmnError?

Best regards,

waldo
Champ in-the-making
Champ in-the-making
We also are in dire need of a way to pass results out of subprocesses (executed via CallActivities) in the case of errors in our project.

We currently use error end events to exit a subprocess in the case of an error and boundary error events attached to the CallActivities in calling processes. In a new use case we have to somehow attach data to the error event, because out-parameters of CallActivities (which we use to pass information back to the caller for regular end events) don't seem to be written in the case of error events.

I've seen there is a JIRA feature request for this https://jira.codehaus.org/browse/ACT-1462, but without progress in 2013. Is this feature still on the roadmap? Or is there some other way to pass information from callee to caller in the case of an error end event?

Many thanks!

trademak
Star Contributor
Star Contributor
Hi,

I was waiting for a response from Saeid (or somebody else).
I'll ping Saeid about this and let's see if we can add it to the 5.13 roadmap.

Best regards,

trademak
Star Contributor
Star Contributor
Hi Saeid,

I've updated the post with the code, it was gone due to the rendering of the new forum.
If you add a blockquote element to your code it will be better readable as well.
In the case of this error event definition, I don't think we need an source and target definition, but only a way to express which variables should be part of the error payload. So that's the background of my code proposal. WDYT?

Best regards,

smirzai
Champ on-the-rise
Champ on-the-rise
Hi Tijs,
First of all, it seems that you have inserted a piece of XML in your above #17 comment, which is not readable Do you have it somewhere ?

Lets have a wrap up. We need extensions on two parts, catching and throwin. And either of them can be done in two ways, BPMN standard and activiti shortcut.

1. BPMN standard
If we want to stick to the standard, based on the specification, these could be throwing and catching parts.

Sample throwing, BPMN style, Long version:

<endEvent id="myErrorEndEvent">
        <dataInput id="event_variable" />
    <dataInputAssociation>
            <sourceRef> process_variable </sourceRef>
                 <targetRef> event_variable" />
                 <assignment>
                    <from> ${process_variable.field}</from>
                    <to>${event_variable.field}</to>
                 </assignment>
      </dataInputAssociation>
      <errorEventDefinition errorRef="myError" />
</endEvent> 


or simpler:

Sample throwing, BPMN style, shorter version:

<endEvent id="myErrorEndEvent">
        <dataInput id="event_variable" />
    <dataInputAssociation>
            <sourceRef> process_variable </sourceRef>
                 <targetRef> event_variable" />
      </dataInputAssociation>
      <errorEventDefinition errorRef="myError" />
</endEvent> 

sample catching, BPMN style, Long version:


<intermediateCatchEvent id="myErrorIntermediateCatcher">
          <dataOutputAssociation>
            <sourceRef>event_variable</sourceRef>
            <targetRef>process_var2</targetRef>
        <assignment>
            <from> ${event_variable.field}</from>
                       <to> ${process_variable.field}</to>
                </assignment>
          </dataOutputAssociation>
          <signalEventDefinition signalRef="MyMessage" />
</intermediateCatchEvent>

or simpler:

Sample catching, BPMN Style, Short version:


<intermediateCatchEvent id="myErrorIntermediateCatcher">
          <dataOutputAssociation>
            <sourceRef>event_variable</sourceRef>
            <targetRef>process_var2</targetRef>
          </dataOutputAssociation>
          <signalEventDefinition signalRef="MyMessage" />
</intermediateCatchEvent>


Ok, You have already stated clearly at least twice that you are not a big fan of usage of BPMN Data input and Data output specification, but I would like to insist on keeping compatibility with BPMN as far as possible and the same time provide easier activiti specific shortcuts. Actually it is already used in web service task.
Here is my shortcut proposal:

Activiti extension:


Sample throwing, Activiti extension style:

<endEvent id="myErrorEndEvent">
    <extensionElements>
              <activiti:in source="process_var" target="event_var" />
      </extensionElements>       
    <errorEventDefinition errorRef="myError" />
</endEvent>


Sample catching, Activiti extension style:


<intermediateCatchEvent id="myErrorIntermediateCatcher">
    <extensionElements>
              <activitiSmiley Surprisedut source="event_var" target="process_target_var" />
           </extensionElements>
          <signalEventDefinition signalRef="myError" />
</intermediateCatchEvent>