How to write a Async job that shows on Jobs console? | Community
Skip to main content
Level 2
October 17, 2022
Solved

How to write a Async job that shows on Jobs console?

  • October 17, 2022
  • 2 replies
  • 2063 views

I am writing a long-running job that is expected to be intensive and long-running. The Asynchronous Operations looks promising and the Jobs console is nice similar to workflow console, showing job status, logs etc. 

 

How to write a new custom async job? Am able to create sling job, stores into /var, but it is NOT showing in Jobs console. How to get the custom jobs show under Tools --> General --> Jobs console?

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 Lokesh_Vajrala

In order to see your custom job under Tools --> General --> Jobs console, you've to write a new class implementing 

AsyncOperationConfigProviderService

separate from the actual sling async job implementation. 

 

This Servlet renders jobs data in console - 

AsyncJobsDataSourceServlet

which displays the jobs that are implementing AsyncOperationConfigProviderService. For reference, please check the following component services in OSGi console (/system/console/components) 

  • com.adobe.granite.jobs.async.ui.commons.AsyncJobsDataSourceServlet
  • com.day.cq.dam.asset.sourcing.impl.async.AsyncAssetImportConfigProviderService

 

One thing I could not confirm is that uber-jar or aem-sdk-api(for cloud service) exposes the AsyncOperationConfigProviderService for custom implementation. 

2 replies

Sachin_Arora_
Community Advisor
Community Advisor
October 17, 2022

Hi @saravana_sgws 

 

Looks like Async APIs are Adobe internal APIs and you can not use same. I used Java Decompiler to check how Async jobs are created. This is the class Adobe has used to extend to write Async Job : 

com.adobe.granite.jobs.async.commons.AbstractAsyncJobExecutor

But there is not much information of same online. 

If you want to see the status of Sling jobs, you can go to /system/console/slingevent and search for the topic you used to create a job. It will show you the count of failed/completed jobs. For example 

 

 

 

Level 2
October 17, 2022

Thanks Sachin. Yeah, I too am decompiling, duplicating the code and trying to make it work. Just the Jobs console looks better than felix, shows logs, can add interested properties. Was wondering if anyone had already managed to write a custom async job successfully. 

Adobe Employee
November 5, 2024

Hi @saravana_sgws  were you able to achieve the above custom job in the job console. we are also looking for the same? I have created a sling job and storing csv into the var folder.

 

can you please share how did you achieve the same in detail? I couldn't find anything in online.

 

The mentioned package

AsyncOperationConfigProviderService

is not coming in aem sdk or uber jar.

Which dependency needs to be added for this?

Lokesh_Vajrala
Community Advisor
Lokesh_VajralaCommunity AdvisorAccepted solution
Community Advisor
October 17, 2022

In order to see your custom job under Tools --> General --> Jobs console, you've to write a new class implementing 

AsyncOperationConfigProviderService

separate from the actual sling async job implementation. 

 

This Servlet renders jobs data in console - 

AsyncJobsDataSourceServlet

which displays the jobs that are implementing AsyncOperationConfigProviderService. For reference, please check the following component services in OSGi console (/system/console/components) 

  • com.adobe.granite.jobs.async.ui.commons.AsyncJobsDataSourceServlet
  • com.day.cq.dam.asset.sourcing.impl.async.AsyncAssetImportConfigProviderService

 

One thing I could not confirm is that uber-jar or aem-sdk-api(for cloud service) exposes the AsyncOperationConfigProviderService for custom implementation.