Hello,
what exactly do you try to achieve with your TimerTask?
Depending on what you try you could use a non-interrupting timer event[1] and pass it the intervall. The timer event could call a service task, which could directly call "camundaServiceExecutionController.testTimer()".
<bpmn2:serviceTask id="Task_1" camunda:expression="#{camundaServiceExecutionController.requesterProcessTicketRequest()}" name="ServieTask1"/>
<bpmn2:boundaryEvent id="BoundaryEvent_1" name="" attachedToRef="Task_1">
<bpmn2:extensionElements>
<fox:failedJobRetryTimeCycle>PT6000S</fox:failedJobRetryTimeCycle>
</bpmn2:extensionElements>
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
<bpmn2:timerEventDefinition id="_TimerEventDefinition_2"/>
</bpmn2:boundaryEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="BoundaryEvent_1" targetRef="ServiceTask_1"/>
<bpmn2:serviceTask id="ServiceTask_1" camunda:expression="camundaServiceExecutionController.testTimer()" name="Timer">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
</bpmn2:serviceTask>
Alternatively, you could inject the "camundaServiceExecutionController" into your CoordinatorSearchTimerm. Then you could get rid of the long call chain and be safe that you only call existing methods on it.
public class CoordinatorSearchTimer extends TimerTask {
private String taskId;
@EJB
private UserRoleMappingDAO userRoleMappingDAO;
@Inject
private RuntimeService runtimeService;
private BusinessProcess businessProcess;
@Inject
private CamundaServiceExecutionController controller
@Override
public void run() {
controller.testTimer();
}
}
The fields of your CoordinatorSearchTimer are null because you created the object with "new" and therefore it is not managed by CDI. To change this you have to have the timer injected into your listener so that the BeanManager handles the instantiation.
Cheers,
Ronny
[1]
http://docs.camunda.org/7.2/api-references/bpmn20/#events-timer-events