Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Workflow Object State Not Updating Inside of Thread

Avatar

Level 1

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

0 Replies

Avatar

Correct answer by
Community Advisor

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