How to limit a specific workflow to execute only one instance at a time? | Community
Skip to main content
Level 2
March 27, 2024
Solved

How to limit a specific workflow to execute only one instance at a time?

  • March 27, 2024
  • 1 reply
  • 879 views

I have a custom workflow that can be executed by a program.

However, I want to ensure that only one instance of it runs at a time.

Any additional instances should be queued for later execution.

I have tried configuring it using Apache Sling Job Queue Configuration, but it seems that I cannot achieve the desired effect.

Can anyone help me solve this problem?

Thank you all in advance.

 
 
 
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 lukasz-m

Hi @charlie_yc,

I think that the root cause of your issue is the fact that OOTB there is already Apache Sling Job Queue that handles workflows.

 

 

 

 

As you can see it is using wildcard in the Topic filed com/adobe/granite/workflow/transient/job*

That means your workflow could be either handheld by your custom queue or the default one.

As a solution you can try to increase Ranking value in configuration of your Apache Sling Job Queue. This should guarantee that only your queue will be used for your specific topic/workflow.

Please also double check if your workflow is handled by your custom queue - you can check that under /system/console/slingevent

1 reply

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
March 27, 2024

Hi @charlie_yc,

I think that the root cause of your issue is the fact that OOTB there is already Apache Sling Job Queue that handles workflows.

 

 

 

 

As you can see it is using wildcard in the Topic filed com/adobe/granite/workflow/transient/job*

That means your workflow could be either handheld by your custom queue or the default one.

As a solution you can try to increase Ranking value in configuration of your Apache Sling Job Queue. This should guarantee that only your queue will be used for your specific topic/workflow.

Please also double check if your workflow is handled by your custom queue - you can check that under /system/console/slingevent

Level 2
March 28, 2024

Hi @lukasz-m 

After increasing the ranking, it worked.

Thanks for the help!!