I am making an asynchronous communication with an external system using send and receive task. Now the requirement is to create an incident if the response from the external system does not come after X hours. At the same time, if the response comes after X hours say for example X+Y hours, then, close the incident and progress with the flow.
To achieve this I have used non-interruptive boundary timer event on Receive task. Now for creating the incident, I have written the following code in the end execution listener of the timer
Incident incident = camunda.getRuntimeService().createIncident(“failedJob”, execution.getId(), null, “Timeout Occured”);
The custom incident handler is invoked and the incident is created but the incident could not be seen on the cockpit.
On the contrary, if I throw a Exception from the end execution listener of the timer, the incident is created and is visible on the cockpit.
Why is this behaviour?
Also one more problem I am encountering in the scenario wherein the timeout has not occurred (and the pointer is at the Receive Task) and the external system has sent the error response. In this case also the requirement is to create the incident. I have used the following code to create the incident -
String executionId = camunda.getRuntimeService().createExecutionQuery().messageEventSubscriptionName(“ReceiveTask”)
Incident incident= camunda.getRuntimeService().createIncident(“failedJob”, executionId, null, “receiveTaskIncident”);
The incident is created on receive task but it does not have an option of incrementing the job retries.
I have also tried to create incident from the Receive Task end execution listener but it does not work. Please help
PS: I am using execution listeners to do most of the job as customer does not want to see the incident creation steps on the bpmn model