Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Workflow Priority

Avatar

Level 2

Hi

I currently have a Workflow that is set to launch automatically at 2PM everyday. I am using Scheduler to launch the Workflow. However, I will need that Workflow to have a High Priority. I was wondering how I could set that Workflow to have a High Priority so that the Workflow executes before others. I have tried to go to OSGi Configurations to "Queue: Granite Workflow Queue"  and it does not have an option for me to specifically choose only that specific Workflow to have a High Priority. Please help me navigate how I could resolve this. 

 

Best Regards.
Sching

4 Replies

Avatar

Community Advisor

HI @ChanuteJo ,

You can define service ranking and give it a higher value.

Service ranking is defined by the OSGi Core Specification as follows: If multiple qualifying service interfaces exist, a service with the highest service.ranking number, or when equal to the lowest service.id, determines which service object is returned by the Framework.
 Annotation use for it is :
@ServiceRanking(200)
For more details on it, you can refer:

https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-authentication...


Thanks
Tarun

Avatar

Level 2

Thankyou for the suggestion

 
How do I know which of the OSGi Configuration I should Configure as there are so many AuthenticationHandler? I want to set a specific workflow to have the highest service.ranking. Could you maybe help me navigate that?

Best Regards 
Sching

Avatar

Level 4

Hi @ChanuteJo ,

 

You should be able to configure it like this

{
  "queue.name":"Workflow Queue Configuration",
  "queue.priority":"MIN",
  "queue.maxparallel": 15,
  "queue.topics":[
    "com/adobe/granite/workflow/job/var/workflow/models/<yourworkflowname1>",
    "com/adobe/granite/workflow/job/var/workflow/models/<yourworkflowname2>",
    "com/adobe/granite/workflow/job/var/workflow/models/<yourworkflowname3>"
   ],
  "queue.retries": 0,
  "queue.preferRunOnCreationInstance":true,
  "queue.threadPoolSize":0,
  "queue.retrydelay":2000,
  "service.ranking":1000,
  "queue.type":"TOPIC_ROUND_ROBIN",
  "queue.keepJobs":false
}

you can define your workflow at the top and then others .

Avatar

Level 2

Thankyou for the suggestion. 


So I just have to create new OSGi configuration and use this a a code? Or how do I add this line of code into the OSGi configuration. Please help me navigate I am quite new to AEM.

Best

Sching