Workflow Object State Not Updating Inside of Thread | Community
Skip to main content
rscott-sbux
March 29, 2022
Solved

Workflow Object State Not Updating Inside of Thread

  • March 29, 2022
  • 1 reply
  • 608 views

Hello all!

 

I have a service set up that runs sub-workflows in batches based on a set size (currently 15 but configurable to other values). It is multi-threaded (I have tested the concurrency and it appears to follow an appropriate ordering 100% of the time). The goal is to have a parent thread call workflowSession.startWorkflow(...), wait until the workflow completes, then release its thread back to the pool (I'm actually using a semaphore and an ExecutorService which might not both be necessary but shouldn't affect how anything works). The way I am accomplishing waiting until a workflow is completed is waiting the thread on a monitor stored in a map with the key being the workflow id. An EventHandler listens for workflow complete events and calls notify on that map at the workflow id (these are currently lining up properly).

 

The issue that I am having is that I have a while guard (surrounding the wait call) that loops while the workflow.isActive(). The local workflow object appears to always be in a RUNNING and isActive = true state (I have checked that the event timing isn't the issue by allowing the call to wait to time out after 1000ms and it never updated after even 2min after the workflow completed). Does anyone know why the state of the local java object representing the workflow isn't updating? Thanks in advance!

 

I understand that Adobe does not recommend launching workflows from within another workflow (it appears their reasoning is that creating Session objects is expensive).I understand that this also sounds like a use case for Multi-Resource-Support but that does not support Assets yet. I do not wish to bump up the number of allowed workflows for simultaneous launch as this is not only not recommended, but will bring the system to a crawl with the number of assets that might be regularly used (somewhere around 2k assets max but testing with synthetic loads of 5k assets).

 

TLDR: Workflow java object state does not reflect the actual state of the workflow instance. Why might this be happening?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kishore_Reddy

Hey @rscott-sbux 

Hope you are doing well!

In case this is a question corresponding to Adobe Experience Manager (AEM), kindly post your question here: AEM Sites & more for a faster resolution and participation from the community.

This space is for Adobe Experience Platform (AEP). Thank you and have a nice day 🙂

Best,

Kishore

1 reply

Kishore_Reddy
Community Advisor
Kishore_ReddyCommunity AdvisorAccepted solution
Community Advisor
March 30, 2022

Hey @rscott-sbux 

Hope you are doing well!

In case this is a question corresponding to Adobe Experience Manager (AEM), kindly post your question here: AEM Sites & more for a faster resolution and participation from the community.

This space is for Adobe Experience Platform (AEP). Thank you and have a nice day 🙂

Best,

Kishore