Hello,
It would be nice to know few details on below queries.
1. If the returned Job Result type is 'CANCEL', then would it indefinitely remain persisted in AEM JCR under ''/var/eventing/jobs/cancelled/<JOB_TOPIC>/<yyyy>.... path. Or is there any OOTB maintenance activity that cleans up these periodically ?
2. As per the document it says, "processing failed permanently and must not be retried." for CANCEL types. So, does all cancel returned items are saved in JCR with slingevent:finishedState as ERROR?
3. In the loggers we can see, 'org.apache.sling.event.impl.jobs.queues.JobQueueImpl.<main queue> Failed job Sling Job' messages with multiple retrial attempts (default 10 in main queue if a dedicated sling queue not configured). If we want to avoid retries for any job, what should be the ideal thing to perform?
4. If we do NOT want any jobs to remain pending/stuck in main queue through application logic, then will the below snippet be good? If the job be removed/not exists, still It would return CANCEL. So, again point 1 comes here.
private JobResult removeJob(Job job) {
if (jobManager.removeJobById(job.getId())) {
return JobResult.CANCEL;
}
return JobResult.OK;
}
So, if we simply return JobResult.OK in every use case irrespective of custom application logic outcome, will it ensure that no sling jobs for that topic will remain stuck.
If it's an AEM instance issue, the obviously it may happen but not in other happy scenarios.
Any help would be great there! Thanks