Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to call an JobResult process(Job job) method from an event handler method.

Avatar

Level 4

Team,

We need to call a job process method [ JobResult process(Job job) ] from an event handler handleEvent(final Event event). 

Few items got deprecated so we are using JobConsumer api's instead of org.apache.sling.event.jobs.JobProcessor & org.apache.sling.event.jobs.JobUtil.

Any help is appreciated . Thanks in advance..

 

Regards,

Teja G

3 Replies

Avatar

Level 4

Correct.. we are using that API, but in over case we need to call process() when an event occurred like page activate or deactivate?? So coming back to the question:: how to call a process when an event occurred. 

Avatar

Level 4

Hi, Teja.

I couldn't follow you... Can you give me a real example (with some code) of the case that you've described?

When talking about activation/deactivation, we usually use Preprocessors instead of JCR Events or Sling Jobs:

https://docs.adobe.com/docs/en/aem/6-2/develop/ref/javadoc/com/day/cq/replication/Preprocessor.html

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/ad...

Are you trying to call a Job from a JCR Event Listener? Is that your use case?

Regards,

Daniel.