Hi, everyone. Can’t understand, why this job doesn’t work? Very simple job. Trying to exec a manual cron job, as described here: https://documentation.bloomreach.com/12/library/concepts/hippo-services/repository-scheduler.html
What I’m doing wrong?
Hi, everyone. Can’t understand, why this job doesn’t work? Very simple job. Trying to exec a manual cron job, as described here: https://documentation.bloomreach.com/12/library/concepts/hippo-services/repository-scheduler.html
What I’m doing wrong?
This job should be executing every minute. I have already tried this expressions: “* * * * * ?”, “0/1 * * * * ?”. But I think problem is not there.
Hmm, are you sure no breakpoints are hit? I can see one problematic place: SelectionUtil.getValueListByIdentifier … that one requires a request context to be present (there is none in that job execution context). you are probably hitting NPEs.
If you set a breakpoint at the very beginning of execute(), does that get triggerred?
How about setting hipposched:enabled=true on that node, or two levels up in the HeProxyContainerCheckingJob?
No, it doesn’t. Doesn’t triggered. I set breakpoint at the first line of “execute” method. About SelectionUtil I will use RepositoryJobExecutionContext then, but I can’t get there.
It’s enabled. You can see it at the picture.
Hi,
the field hipposched:nextFireTime is showing at what time the job will be executed according to the cron expression you have set up. Is that time correct for you?
It’s not possible to add property hstsched to another nodes, only to repositoryjob.
Hi. Yes it’s correct. GMT +6. This date updated right after updating console page. Don’t know is it right or not.
No, wait. This date is changing only after this time is reached. For example, this time “2020-01-20T22:27:08.000+06:00” will be set after this time is reached, after 22:27:08. Here’s really something wrong. Or it’s ok for this?
Any ideas why it doesn’t work? Maybe it needs to specify as a bean? Or smth else.
I just tried it locally on a v12 project and documentation worked fine for me. My steps were:
Add dependencies to cms pom.xml:
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-services</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-repository-api</artifactId>
</dependency>
Write a dummy job:
package com.bloomreach.jobs;
import org.onehippo.repository.scheduling.RepositoryJob;
import org.onehippo.repository.scheduling.RepositoryJobExecutionContext;
import javax.jcr.RepositoryException;
public class DummyJob implements RepositoryJob {
@Override
public void execute(RepositoryJobExecutionContext repositoryJobExecutionContext) throws RepositoryException {
System.out.println("This gets executed");
}
}
Add the config (requires restart):
/example:
jcr:primaryType: hipposched:jobgroup
/dummyjob:
jcr:primaryType: hipposched:repositoryjob
hipposched:attributeNames: [foo]
hipposched:attributeValues: [bar]
hipposched:enabled: true
hipposched:repositoryJobClass: com.bloomreach.jobs.DummyJob
/hipposched:triggers:
jcr:primaryType: hipposched:triggers
/everythirtyseconds:
jcr:primaryType: hipposched:crontrigger
jcr:uuid: 040c1d3a-97f1-4811-adc5-725efbeed172
hipposched:cronExpression: 0/30 0/1 * 1/1 * ? *
hipposched:nextFireTime: 2020-01-21T09:26:00+01:00
screenshot:
Did you perhaps skip any of these steps ?
Can you set job that working every minute and show me your config yaml file.
I have this config which doesn’t work.
/example:
jcr:primaryType: hipposched:jobgroup
/dummyjob:
jcr:primaryType: hipposched:repositoryjob
hipposched:attributeNames: [foo]
hipposched:attributeValues: [bar]
hipposched:enabled: true
hipposched:repositoryJobClass: com.bloomreach.jobs.DummyJob
/hipposched:triggers:
jcr:primaryType: hipposched:triggers
/everyminute:
jcr:primaryType: hipposched:crontrigger
jcr:uuid: 040c1d3a-97f1-4811-adc5-725efbeed172
hipposched:cronExpression: 0 * * ? * *
hipposched:nextFireTime: 2020-01-21T10:58:00+01:00
Is this right? (Post must be more than 20 symbols))))
As I know hippo uses unix notation for cron: https://crontab.guru/every-1-minute
This executed every minute for me. I used this one i think https://www.freeformatter.com/cron-expression-generator-quartz.html If you add wrong format you should see errors in the terminal
I tried the one in the link you shared. It gave me errors in the terminal
Ok. It’s not working for me. But I’m using now Spring scheduler.
Second question, do you know how I can get ValueList object from session? In my scheduler I don’t have request context. Or how can I convert Node type to HippoBean type?