Cannot use Timer boundary event (non interrupting)

I have requirement to execute some service task infinitely and, always call it from user task , i am using Timer boundary event (non interrupting) with cycle of
R/10S , but my user task doest execute service task at all,
Screenshot from 2023-07-26 19-38-24

how can i achive this?

Hello dude \o !

Maybe i didn’t understand your need very well, maybe if you can explain the idea better to me we can have a more adequate solution.

But let’s go…

When your instance token arrives at the user task, every 10 seconds a new token will be generated towards your service task to perform the service call, the big problem is this will happen for each instance that arrives at the user task… that is, if you have 100 instances stopped in user tasks, every 10 seconds 100 new tokens will be generated, 100 new calls to your service endpoint, and this will exhaustively overload your application.

I don’t advise this.

You mentioned the word “infinitely”, but I didn’t quite understand.

By the name of your tasks, I believe you need to run the service only ONCE for each instance that arrives in your user task. And if so, you can do it with an event subprocess using a conditional event in it so that it is triggered when a certain variable is created.

For example, you can in your user task define the creation of a local variable for when the verification user task is completed, create a boolean variable called “verificationCompleted” with value true.

And in your conditional event settar so that it starts when the variable “verificationCompleted” is == true according to the example below:

If it’s not exactly as I thought… you can bring your need to us, we’ll try to help!

See you later!

William Robert Alves

Hi William Robert Alves,

First and foremost, thank you for your response. I will try to clarify my thoughts with a more organized explanation.

In this BPMN model, my objective is to achieve the following flow:

  1. The process starts with an event (0 in the picture).
  2. It then moves to a user task called “Change Document Status” (1 in the picture).
  3. The user task waits for a submission. If the submission is not made within a specified time, for example, R/PT4H (meaning “Repeating/Periodic Timer every 4 hours”), it should trigger a service task called “System Refund Check” (2 in the picture). This service task involves making a REST call. If the response to the call is “rejected,” the entire process should end. However, if the response is anything other than “rejected,” the process should wait for another 4 hours and then attempt the check again (periodically by 4 hours).
  4. On the other hand, if the user task “Change Document Status” (1 in the picture) is claimed and submitted before the timer ends, it should move forward to a service task labeled “Process with Variables” (3 in the picture).

I hope this explanation makes the process flow clearer. Let me know if you have any further questions or need additional information.

Hello my friend!

I would do it the following way:
The user task timer would be non-interruptin, of type “Duration”, so when the processInstance arrives at the User task, after 4 hours another instance token will be created that will execute your REST call. (Please… consider System refund check as a service task in my BPM example).

Below is an example of how camunda will behave… as I said earlier, it will have the user task running and will also run the service task.

When the service task finishes, it should return a response that in my example I called “systemRefundVariable”, if it has a value != “Rejected” it will go to the timer and wait 4 hours to do the looping and reach the service task again.

If the value of the variable is == “Rejected”, the created token will arrive at the “terminate event”, and will end all the active tokens of this instance at once, ending even the user task.

In the user task, an END “execution listner” of type “expression” can be added to create a variable called “processEnded” with the value true, and also create a START execution listner of type expression with value false.

Exemple below:

This will cause when starting the user task, camunda will create this variable processEnded as false, signaling that the process will not be finished yet, and will not let the timer token finish.

When the user task is completed by the user, it means that the process was concluded and the document was received correctly, this will trigger the END Execution listner, saying to assign the value “true” in the processEnded variable, and as soon as the timer token reaches the exclusive gateway again, it will follow the path of processEnded.

NOTE: While I was typing the explanation, I thought better of the BPM, and you can even use an “Event based gateway” instead of an exclusive gateway… because that way the token will be waiting in the event based gateway until one of the conditions is met, or the timer is activated.

As I had previously modeled… if your token arrived on the timer, it would remain there until it went through the service task again and reached the exclusive gateway again and validated the condition. So without a doubt the best would be to use an “Event Based Gateway”.

Something like:

I hope this helps!

William Robert Alves

1 Like

Hi William Robert Alves, I wanted to take a moment to express my sincere gratitude for your thoughtful reply and invaluable advice. Your willingness to help and share your expertise made a significant difference, and I couldn’t be more thankful. thank YOU!!!))))

1 Like

Thank you my friend! :pray: :heart:

These kind of comments motivate us to try to improve and help people more and more!
Thank you very much and I am always available to help and share knowledge when needed \o

William Robert Alves

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.