I tried to implement a simple scheduler. Here is my code:
package de.lienas.feeds.api;
import org.onehippo.repository.scheduling.RepositoryJob;
import org.onehippo.repository.scheduling.RepositoryJobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
/***
* Imports feeds from {@link de.lienas.feeds.dao.FeedReader}
*/
public class FeedImporter implements RepositoryJob {
private static final Logger logger = LoggerFactory.getLogger(FeedImporter.class);
public FeedImporter() {
}
@Override
public void execute(RepositoryJobExecutionContext repositoryJobExecutionContext) {
logger.info("Successfully started scheduled job for import of feeds");
try {
Session session = repositoryJobExecutionContext.createSession(new SimpleCredentials("admin", "admin".toCharArray()));
logger.info("Successfully connected to Repository :-)");
session.logout();
} catch (RepositoryException e) {
logger.error("Could not connect to repository: {}", e.getMessage());
}
}
}
The class is inside a separate modul! I configured the scheduler job manually:
/feeds:
jcr:primaryType: hipposched:jobgroup
/ImportFeeds:
jcr:primaryType: hipposched:repositoryjob
hipposched:repositoryJobClass: de.lienas.feeds.api.FeedImporter
/hipposched:triggers:
jcr:primaryType: hipposched:triggers
/EveryMinuteTest:
jcr:primaryType: hipposched:crontrigger
jcr:uuid: 62d45379-f2b7-44ca-8f72-415b2c22c1ca
hipposched:cronExpression: 0 0/1 * * * ?
hipposched:nextFireTime: 2020-03-04T20:32:00+01:00
The nextFireTime get refreshed every minute as exspected. I do not get any log-info. I also tried to call one of the predefined jobs org.hippoecm.repository.logging.EventLogCleanupJob- same result no log entry.
What did I miss?