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

Avatar

Avatar

Teja_G

Avatar

Teja_G

Teja_G

06-03-2017

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

Replies

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

06-03-2017

Avatar

Avatar

Teja_G

Avatar

Teja_G

Teja_G

06-03-2017

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

Avatar

daniel_henriqu1

Avatar

daniel_henriqu1

daniel_henriqu1

06-03-2017

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.