As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
testJobCommandsWith2Exceptions(org.activiti.engine.test.jobexecutor.JobExecutorCmdExceptionTest) Time elapsed: 0.109 sec <<< FAILURE! java.lang.AssertionError: DB NOT CLEAN: ACT_RU_JOB: 1 record(s) ACT_GE_BYTEARRAY: 1 record(s)
In discussion with Daniel we found another way to handle the configuration of a delay between retries and the amount of retries.For that we provide a listener "FailedJobListener" and an interface "FailedJobCommandFactory". The "FailedJobListener" replaces the "DecrementJobRetriesListener" which previously was used in the class "ExecuteJobsCmd". The new listener uses the factory to create an instance of a command to handle a failed job. Activiti uses by default the "DefaultJobCommandFactory" which implements the new interface to create an instance of the command "DecrementJobRetriesCmd" to provide the logic as previously.Now you can implement your own strategy to handle failed jobs. For example you can implement a strategy to distinguish between the type of the failed job and handle them differently (e.g. set another delay or the the amount of retries).See revision: 3372
<br> public String getFailedJobCommandFactoryByClassName() {<br> return failedJobCommandFactory.getClass().getName();<br> }<br> <br> public ProcessEngineConfigurationImpl setFailedJobCommandFactoryByClassName(String failedJobCommandFactoryClassName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {<br> this.failedJobCommandFactory = (FailedJobCommandFactory) Class.forName( failedJobCommandFactoryClassName ).newInstance();<br> return this;<br> }<br>
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"><br> …<br> <property name="failedJobCommandFactoryByClassName" value="org.activiti.engine.impl.jobexecutor.NoRetryFailedJobCommandFactory" /><br> …<br> </bean><br><br>
<br><bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"><br> …<br> <property name="failedJobCommandFactory"><br> <bean class="org.activiti.engine.impl.jobexecutor.NoRetryFailedJobCommandFactory" /><br> </property><br> …<br> </bean><br>