Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Gateway & Concurrency?

Avatar

Former Community Member

Consider the following:

  • I have a process that has a Gateway with 4 branches.
  • This process has an XML variables called xml_data that is considered to the be the "master".
  • Each branch of the gateway has a user task.
  • Each user task form has it's form data set to xml_data in it's properties.
  • When the user task is complete, I need to extract specific parts of the XML from the completed form data and insert it back into the "master".  I wrote a DSC to do this.  It's a lot easier than doing this XML manipulation in Workbench.  The DSC takes the "master" xml, the form results, and returns a new version of the "master"
  • When all routes of the gateway are complete, the actions of each of the 8 users should be reconciled with the "master" XML

Gateway.png

I don't know enough details about the threadedness, concurrency or asynchronous nature of LiveCycle.  Is it possible that I could be in the middle of executing the DSC for extracting the XML in a branch when another DSC starts, leading to an overlapping of the process XML updates?

3 Replies

Avatar

Former Community Member

I ran a test.  I did experience concurrency issues, i.e., dirty writes.

My suspicion is that even using a SetValue (rather than my custom DSC) could still see this issue.   After all, under the hood, the SetValue is a Java component which takes parameters and provides an output.  I could write test code to prove this I guess.

I think my only real choice to resolve this is to write my own mutex to serialize access to my critical process variable.  If mutex is set, route to Wait activity and try again later.

Avatar

Former Community Member

So, this is bizarre.

I set up a 4 branch Gateway.  Each branch has 3 operations.  The 1st activity in each branch is a sub process that has a user task embedded in it.

If the user tasks are completed so they don't occur at the same time, this all seems to work fine.  However, if Approver 1 and Approver 2 (any pair of Approvers, I just 1 and 2 in my example) submit their forms at the same time, I get results like I show below.

Note, the variable approver_01 is ONLY updated in branch 1 and the variable approver_02 is ONLY updated during branch 2.

approver 2 branch.png

approver 2 vars.png

A little hard to see, but you can see the approver_02 xml variable has a value after the 1st operation in branch 2.  This is correct.

approver 2 branch operation 2.png

approver 2 vars operation 2.png

At the end of the 2nd operation in branch 2, I should see still approver_02 with a value, and all others <empty>.  That is not what I see though.  Somehow the variable that I assigned to that branch is <empty> and a variable only assigned during branch 1 has a value.

How can that be?  There is something odd with concurrent operations that I am missing.

Avatar

Level 3

I have seen this issue. If you use the same variable and modify its values in a setvalue operation within gateway, it will give you this issue because of some race-conditions.

Is it mandatory that you use the same variable? Any business logic? I would advise using different variables within gateway and putting a logic after gateway to handle the data coming from different variables.