AnsweredAssumed Answered

Exception handling for Async executor

Question asked by nixikanius on Oct 17, 2016
Latest reply on Oct 31, 2016 by nixikanius
I want to implement global exception handling like it suggested to do for Job executor ( 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" />

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;

def public Object execute(CommandContext commandContext) {
   println "HELLO2!"

public class FailedJobCommandFactory implements FailedJobCommandFactory {
  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?