AnsweredAssumed Answered

Best approach to get remaining retries in Service Task

Question asked by vdreo on Nov 28, 2017



I am new to Activiti, and may lack some of the knownloedge needed to understand what happens under the hood.


Let's explain...for the moment, I found two methods that can give me the number of retries in a service task of an async connector.


Two methods are :

- Context.getJobExecutorContext().getCurrentJob().getRetries()

- Context.getCommandContext().getJobEntityManager().findJobsByExecutionId(execution.getId()).get(0).getRetries()


The first one can be used only within a connector with boundary error plugged, because the second returns no job.


On the other hand, without any boundary plugged in the connector, I can only use the second method (because Context.getJobExecutorContext() is NULL in the first).


First question, why am I able to getJobExecutorContext only if a boundary is plugged ?

Is there a better alternative, or a method that can work for both cases ?


Thank you a lot, in advance,


Victor D.