07-10-2014 12:35 PM
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<!– … –>
<property name="jobExecutor">
<bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.DefaultJobExecutor">
<property name="waitTimeInMillis" value="60000" />
</bean>
</property>
</bean>
if (jobsAcquired < maxJobsPerAcquisition) {
// …
} else {
millisToWait = 0;
}
07-10-2014 06:01 PM
07-11-2014 12:43 AM
1. Could someone please explain to me the reason why someone would want a job to execute immediately when the maximum number of jobs has been acquired?In the case when maxJobsPerAcquisition were acquired we can expect that there are still another jobs to execute. that why we should check once again.
2. What would you suggest to wait before retrying a job?It depends on your requirements and activiti implementation I would not recommend to set it <=1000 ms for activiti <= 5.15.1.
Somehow overriding a FailedJobCommandFactory?
07-11-2014 05:54 AM
In the case when maxJobsPerAcquisition were acquired we can expect that there are still another jobs to execute.
It depends on your requirements and activiti implementation I would not recommend to set it <=1000 ms for activiti <= 5.15.1.
5.16 should be able to handle wait time < 1000 (https://github.com/Activiti/Activiti/pull/312). But again I would not recommend to use value < 500ms. (I does not make sense to set this value <1000ms for long running business processes). Another limitation is DB implementation of timestamp precision (e.g. older MYSQL).
Somehow overriding a FailedJobCommandFactory?I had an idea to create a Command that would somehow force the job to wait before retrying a failed job. Yes, I understand that this would block one of the JobExecutor's threads. I'm looking for a better way, though. Any ideas?
07-14-2014 01:09 AM
07-14-2014 08:09 AM
07-15-2014 01:25 AM
<timeDuration>PT1S</timeDuration>
it means timer should be fired 1sec after process deployment.
public void pokeJobExecutor(JobEntity job) {
JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
int waitTimeInMillis = jobExecutor.getWaitTimeInMillis();
if (job.getDuedate().getTime() < (Context.getProcessEngineConfiguration().getClock().getCurrentTime().getTime()+waitTimeInMillis)) {
hintJobExecutor(job);
}
}
and hint jobExecutor
protected void hintJobExecutor(JobEntity job) {
JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
JobExecutorContext jobExecutorContext = Context.getJobExecutorContext();
TransactionListener transactionListener = null;
if (job.isExclusive()
&& jobExecutorContext != null
&& jobExecutorContext.isExecutingExclusiveJob()) {
// lock job & add to the queue of the current processor
Date currentTime = Context.getProcessEngineConfiguration().getClock().getCurrentTime();
job.setLockExpirationTime(new Date(currentTime.getTime() + jobExecutor.getLockTimeInMillis()));
job.setLockOwner(jobExecutor.getLockOwner());
transactionListener = new ExclusiveJobAddedNotification(job.getId());
} else {
// notify job executor:
transactionListener = new MessageAddedNotification(jobExecutor);
}
Context.getCommandContext()
.getTransactionContext()
.addTransactionListener(TransactionState.COMMITTED, transactionListener);
.addTransactionListener(TransactionState.COMMITTED, new JobAddedNotification(jobExecutor));
}
07-16-2014 04:14 AM
11-02-2015 05:38 AM
11-02-2015 06:23 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.