Timer event is not being triggered while waiting for http call response

Hi,

I have attached a print screen with a part of my process. I have a timer event set at 30 seconds that I want to be executed if I don’t get a response from the API that I’m calling in the “Get asset details” task.

So let’s say the response is taking around 1 minute, I need the timer to be executed and terminate the process before I get the response from API.

Right now the timer does not get executed, as it waits until the call is completed and the response is received. I have the feeling that it waits forever until the “send task” is being completed.

Please help me out to figure out how to get the timer executed at the specified time, independently of the response from the API.

Thank you in advance,
Lucian

Screenshot%20from%202019-11-24%2014-03-41

True, this is expected.process instances on the engine are single threaded. A timer event will never interrupt a running thread. so if the send is running in the process engine thread another thread will not interrupt it. depending on how you’ve implemented the sending and the timer it could be the case that the timer will start once the initial “get assert details” has been successfully run. at which point it will either wait for the response or for the timer to trigger

Hi Niall,

Thank you for the response.

So you are suggesting that maybe I should put the timer on the “get asset details” task?
How would you treat this problem?
My business logic here is that the process to end if it’s waiting more than 1 minute for the response.

Thank you in advance for your help.

Lucian

When you say “waiting” what are you waiting for exactly?
Can you let me know how you’re implementing the send task and where the send task is going and also how is the response expected?

So the “send task” implementation is through the delegate expression method. So when the corresponding java class is being reached and the code executes, an external web service is being called, practically is calling an API through a generated web service client and expecting a response with some data. When the response is received, we process the data and correlate the message to activate the sequence flow that is expecting the message. My need here is that if the web service server part is not responding in less than 1 minute and the code execution is actually being stuck there, to activate the “timer” sequence flow that has an “error end event” at the end.

My logic here was that the parallel gateway is starting 2 treads that can execute individually so the timer will start counting as it reached the “event based gateway”.

You’re not going to be able to do this in BPMN, it’s far too granular - the engine can hold multiple states in parallel (hence the gateway) but it will not have more than one thread active for a single process instance. So the engine will never break running code with any kind of event.

What you can do is to implement the break in execution in your code by using a circuit breaker (like hystrix) and then throwing a BPMN Error event from the code to be caught by the model and you can continue the process or end it in any way you want.

Thank you Niall,

So there is now way to stop execution only by code. I understand. I will try to implemented as you suggested.

Lucian