I tried 2 ways to do a periodical background job.
1:sling job. This was executed on both local SDK and AEM cloud, but executed many times when the specified time come.
2:commons scheduler. This is good on a local SDK, but this did nothing on AEM cloud environment.
I want to know how can it be executed with second way(Sling Commons Scheduler).
Here is my sample code
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component(service = Runnable.class, property = { Scheduler.PROPERTY_SCHEDULER_EXPRESSION + "=0 30 * * * ? " })
public class Myjob implements Runnable {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public void run() {
logger.info("this message is from myjob");
}
}
This code above is good on local SDK. On AEM cloud, doesn't work. Please help me.