Timer events synchronous

Hi fellow C users,

I’m wondering as to whether I can delay a request-reply situation by adding a timer. Suppose this scenario. I have a request which generates some info but I don’t want the reply until 20 seconds later because of worksflows that start that need to be synchronized with some other information from a different process.

So basically I want to add a timer to my process and still want it to be synchronous (which is strange I admit) for the task behind the timer. See attached model, does someone know if this is possible? The timer does display Asynchronous options in the modeler but the behavior when sending requests to the engine doesn’t wait for the timer to complete but sends an instant response.

kind regards,

TTimeTest.bpmn (4.6 KB)

Hi @kingspallett,

your process executes the second task immediately after the first task, because you did not configure your timer correctly.

This is the configuration you will need to set in the modeler, if you want that the process waits for 20 seconds at the timer before continuing to the next task:

timerConfig

For more information on timer events and how to configure them, have a look at this site in the documentation.

Hope this helps

Regards
Michael

Yes, I did that in my other model. The timer works correctly, but it saves the state to the engine because a timer is always going to activate the ‘wait-state’. I want a workaround for this. Thank you for your answer.

Hi @kingspallett,

maybe this process does it: https://cawemo.com/share/bb37fc73-4c3b-487a-9213-3cb5440048f3.

As the message catch is noninterrupting, it can recieve multiple messages during the 20 seconds.

Hope this helps, Ingo

Hi @Ingo_Richtsmeier,

Thanks for your input. I tried something similar but the thing I’m trying to achieve is something that is usually not desired from synchronous tasks/flow and I’m doubting whether it’s easily achievable. A timer always seems to make a process continue asynchronously by committing the transaction rather than just waiting for the specified time, continuing the flow and executing the task behind the timer synchronously and returning that response to the original request. As soon as a timer is reached in Camunda the original request gets a response, unfortunately, without the information from the task(s) behind the timer.

Hi @kingspallett.

If I understand your point, I will suggest you to use a Receive Task to control when ‘Run A’ finish processing your request. Making that “synchronous” in two peaces (because it depends on other process). The first send the request, and the second wait for the complete response. That control you have to do on the other process or in an external way.

I did something like that for a process mine with spring.

/*
Receive Task generates a wait state and it's not necessary to configure messages for that, just get the execution and signal that.
*/

runtimeService.signal(execution.getId());

Hope this helps.

Can you just sleep the thread?

@StephenOTT We don’t want to to support that anymore. @regissantana thanks for your reply, i’ll check it out later today.