cancel
Showing results for 
Search instead for 
Did you mean: 

MessageAddedNotification not available

matthiasmoke
Champ in-the-making
Champ in-the-making
Hi all,

i have implemented a CustomFailedJobCommandFactory and a NoJobRetriesCmd with Activiti-5.14 as follows:


public class CustomFailedJobCommandFactory implements FailedJobCommandFactory{

   public Command<Object> getCommand(String jobId, Throwable exception) {
       return new NoJobRetriesCmd(jobId, exception);
   }
}



public class NoJobRetriesCmd implements Command<Object> {

  protected Throwable exception;
  protected String jobId;

  public NoJobRetriesCmd(String jobId, Throwable exception) {
    this.jobId = jobId;
    this.exception = exception;
  }

  public Object execute(CommandContext commandContext) {
      JobEntity job = Context.getCommandContext().getJobEntityManager().findJobById(jobId);
      job.setRetries(0);
      job.setLockOwner(null);
    job.setLockExpirationTime(null);
   
    if(exception != null) {
      job.setExceptionMessage(exception.getMessage());
      job.setExceptionStacktrace(getExceptionStacktrace());
    }
   
    JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
    MessageAddedNotification messageAddedNotification = new MessageAddedNotification(jobExecutor);
    TransactionContext transactionContext = commandContext.getTransactionContext();
    transactionContext.addTransactionListener(TransactionState.COMMITTED, messageAddedNotification);
   
    return null;
  }
 
  private String getExceptionStacktrace() {
    StringWriter stringWriter = new StringWriter();
    exception.printStackTrace(new PrintWriter(stringWriter));
    return stringWriter.toString();
  }
}


I've updated my jars to version 5.17 and Eclipse notices, that the class org.activiti.engine.impl.jobexecutor.MessageAddedNotification is not available.
Has this class been removed or renamed? How can i correct this issue?

Greetings

Matthias
2 REPLIES 2

matthiasmoke
Champ in-the-making
Champ in-the-making
Hi all,

i found the class JobAddedNotification which also implements TransactionListener. I think it will do the job. Smiley Happy

greets

Matthias

jbarrez
Star Contributor
Star Contributor
Yes indeed, that was made more generic a while back.
Getting started

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.