Multi Instance SubProcess deletes input collection

Hello,

I’m completely new to Camunda and the forum. So, please be patient with me :slight_smile:

Precondition
used Camunda-version is 7.6.1.
I’ve created a process processing a list of documents into a refund.
Now I want to do the checking and creating claims from the documents in a SubProcess.
My process calls a Webservice (ServiceTask) and gets back a list of pre-generated Claims.

I saved them in a variable “claims” (claims is of Type ArrayList, I saved them with into processVariables with serializationFormat application/xml)

Next, I call a SubProcess, containing

  • StartEvent
  • ServiceTask checkClaim
  • ServiceTask createClaim
    I defined the SubProcess as MultiInstance/parellel, with async:after= true, inputParameter=${claims} and no Loop Cardinality.

My application contains an ExecutionListener, that logs all existing variables at events “start”, “end” and “take”
So far, it looks like all the examples.

Problem:
By viewing the logs I could verify that my claim-List ist filled correctly after the createClaim ServiceTask. And at the end of the SubProcess(-instance)-Level. Next trace is the end of SubProcess_generate_claims#multiInstanceBody - and now my list ist null!

What the hell happened to my collection? I need it later on.
Obviously this happens to all collections in the procesVariables, no matter if they are used in the MultiInstance-SubProcess or not. Simple data types as well as Single ServiceObjects still exist afterwards.

How do I at least keep my list?
And a suffix-question: I would like to either update the elements of my claims-List with the results of the creation or create a new Collection, containing all results. How do I do this? Is there actually a Chance for adding, since my SubProcess is parallel?

Thanks a lot, mkoerner

Hi @mkoerner,

Could you please provide a unit test reproducing this? You can use the unit testing template to get started.

Cheers,
Thorben

Hello Thorben,
my process is already a bit more complex and contains business data, so I tried to create a test project with just the essential problem.
And of course, it worked just fine. But you kicked my brain to some new lines of thought:

  • my subprocess is actually a subsubprocess -> no, this is not the cause
  • different asynchronous behaviour -> no, this is not the cause

Okay, but I’ll try out my process via JUnit

Hello Thorben,
me again. I finally got my test Project doing the same as the real one - after leaving the Multi instance Body my list of claims is empty. The Project is based on the unit testing template.
Now one stupid question: how do I upload my project anywhere for you to see?
greetings, mkoerner

Hi @mkoerner,

If you are familiar with git, the easiest would be if you could publish it to github.

Cheers,
Thorben

Hello Thorben,
sorry, I am not familiar (yet) with github.

But: a collegue from maintenance found the bug in my application. For saving complex process variables I have used an XML-serialization pattern. As soon as I had removed this all worked. He suggested using JSON anways so I am changing my saving Patterns to JSON. This should work.

Thanks a lot to you, you gave me lots of valuable hints.
mkoerner

Hi @mkoerner,

Nice that you found the problem and thanks for reporting back.

Cheers,
Thorben