April 1, 2020
Estimated Post Reading Time ~

CQ scheduler Example

package com.wemblog;

import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.PropertyOption;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.commons.osgi.PropertiesUtil;
import org.apache.sling.commons.scheduler.Scheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Configuration Factory for Impression Importer class
* Different Path can be configured to import impression from
* @author Yogesh Upadhyay
*
*/
@Component(configurationFactory = true, metatype = true)
@Service(value=Runnable.class)
@Properties(value = {
@Property(name="scheduler.expression", label="Schdeduler expression", description="Cron fashion sheduler expression", value="0 0 05 * * ?"),
@Property(name="scheduler.concurrent", boolValue=false, propertyPrivate=true),
@Property(label="Run On", name="scheduler.runOn", value="LEADER")
})
public class ExampleScheduler implements Runnable{

@Override
public void run() {
// Call your method here

}
}


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.