Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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.

 
 
 
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

workflow-queue.jpg

 

 

 

 

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

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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.

workflow-queue.jpg

 

 

 

 

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

Avatar

Level 2

Hi @lukasz-m 

After increasing the ranking, it worked.

Thanks for the help!!