Task Listener event- timeout is not working properly

So I tried the new feature of camunda bpm 7.12 , specifically the timeout event task listener, but it didn’t work as expected. So I wanted to hit an API at every 20 seconds when I get to a User Task in my flow. But unexpectedly, the API started getting hit even before I started the process. I guess as soon as the war file got deployed, It started hitting the API and that too at a very short interval than specified. There is only miliseconds time interval between each hit. I have attached a screenshot as well.
I don’t understand what is happening so any kind of help will be appreciated.
( I forgot to add space between no. of hits and time so forgive me for that.)

Hi @amar_an_and,

The screenshot you provided only shows the external API endpoint (I assume). Can you provide some example code and diagram on how you set up your Timeout Task Listener?

Best,
Nikola

Hi Nikolai,

You are right the previous screenshot only shows external API endpoint to show the timing of hits. So I am attaching the process diagram here.

Also note that the external API starts getting hit right after deploying the process. I haven’t started any new process instance.

Regards,
Amar

I am also attaching the code of the task listener here.

(Couldn’t upload them together since I’m a new user)

Hi Amar, fwiw I’m seeing strange behavior as well. It seems to work at the prescribed interval and then I’ll get a bunch of executions all at once. I’ll investigate some more.

Joe

Hi Joe,

Please let me know if you find the solution for it. It’s a really cool feature and I wanna add it in my workflow.

Best,
Amar

Hi Amar, it seems there might be issues when the intervals are so short (ie less than 30 seconds). If you use an interval that is greater than 30 seconds it should work as expected.

Joe

Hi Joe,

Unfortunately it is still not working properly. I tried different time settings like 40 secconds, 1 min and 5 min but it is still hitting the external API almost immediately ( the biggest interval I observed was 15 seconds). But what I’m most confused about is that I haven’t started the process yet but it is still hitting the API. My understanding was that the task listener will start after I have reached at the user task in my workflow. Kindly let me know if I’ve misunderstood something.

Best,
Amar

Hi Amar,
Looking at the screen shot again it looks like you may not be referring to the Java class correctly. It’s usually something like org.example.something.etc. Is it possible to upload the project file? Here is how I refer to my java class

1 Like

@Beagler what’s the use of Listener id? I found Listener id is used with timeout Listener only and not with update Listener. Is it optional for all the task Listeners or only mandatory for timeout Listener?

@aravindhrs It’s required if the event happens to be a timeout. It just needs to be unique:
Timeout event requirements

id : a unique identifier of the listener within the scope of the user task, only required if the event is set to timeout .

Hi Joe,

I just used the ‘Copy qualified Name’ option of STS to get that name and since API was getting hit so I thought there’s nothing wrong with it. I again changed the name to the format that you gave but there isn’t any change in the results. I don’t think I can upload the whole project folder here.

@amar_an_and Maybe just zip up the folder and upload? Are you using Camunda in Spring Boot? Tomcat? Did you use one of the Camunda Maven templates to create the project?

Joe

Hi @Beagler

can we retrieve this ID when this event is fired in delegate TASK.

Thanks,
Manish