I want to implement global exception handling like it suggested to do for Job executor (http://flaviodonze.blogspot.ru/2013/04/activiti-overall-exception-handlingin.html). To do this I added configuration in activiti-custom-context.xml for activiti-rest:
<?xml version="1.0" encoding="UTF-8"?>
<beans …>
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="failedJobCommandFactory">
<bean class="org.test.commandFactories.FailedJobCommandFactory" />
</property>
</bean>
</beans>
And my test handler on groovy looks like:
package org.test.commandFactories
import org.activiti.engine.impl.jobexecutor.FailedJobCommandFactory;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
public class JobCommand implements Command<Object> {
private String jobId;
private Throwable exception;
def public JobCommand(String jobId, Throwable exception) {
this.jobId = jobId;
this.exception = exception;
}
@Override
def public Object execute(CommandContext commandContext) {
println "HELLO2!"
}
}
public class FailedJobCommandFactory implements FailedJobCommandFactory {
@Override
def public Command<Object> getCommand(String jobId, Throwable exception) {
println "HELLO1!"
return new JobCommand(jobId, exception);
}
}
But when I test exception handling I do not see any "HELLO1!" or "HELLO2!" in catalina logs. Meanwhile if I turn on Job executor everything works fine. Is there any way to handle exceptions the same way for async executor?