Hi,
I'm using JtaProcessEngineConfiguration in Activiti Engine 5.12 to execute a process with a java service task with async=true attribute.
Service task is executed fine (without exceptions) but due to the application logic issue, when transaction is committed in JtaTransactionInterceptor.doCommit method a javax.transaction.RollbackException is raised and caught by JtaTransactionInterceptor (line 129 of JtaTransactionInterceptor.java in Activiti 5.12)
Because the exception is thrown in JtaTransactionInterceptor.doCommit and not in the service task, the logic to set up FailedJobListener (ExecuteJobsCmd.java lines 73-79) is not executed and I end up with an infinite loop of async job executions.
Surely the application logic that leads to the exception in the first place should be fixed, but I feel that there's a gap in Activiti retry strategy setup mechanism, in my opinion the exception during JTA transaction commit should not lead to infinite loop.
Two questions from my side:
1) Should this be considered a bug? I can create a ticket then
2) What would be a sensible tactical code fix? I was thinking of extending JtaProcessEngineConfiguration with a new command interceptor that would catch org.activiti.engine.impl.interceptor.JtaTransactionInterceptor.TransactionException and execute failed job retry set up logic similar to what we have in ExecuteJobsCmd.java. However it doesn't look like a good solution to me, a generic JtaTransactionInterceptor would have to know of the type of the command being executed.
any help would be much appreciated
thanks,
Andrey