Finding a Job

Hi Guys…

Considerer a process with a multi-instance subprocess and, inside this subprocess, you have a Timer. Each subprocess have a ORDER_ITEM_SEQ variable that is unique for the entire process.

I have to manually trigger execution of a single timer (not all of them) and although I can query jobs and variables separately, I can’t find a way to find which job is associated to which variable instance…

I expected them to be linked by the same executionId (just a I guess, I don’t fully understand what is an execution :smile:) but not, they don’t match…

I thought I could maybe cat Job to TimerEntity and get more information (like activityId) but it throws a null pointer exception.

Any idea ? :grimacing:


I would like to suggest you change your approach. I would not try to trigger a timer. Timer management is the domain of the engine!

I suspect you want to trigger an action. If thats the case, add a receive message into the process model either as a boundary event or an event driven subprocess etc. Then you can inject your own message. You can correlate to an instance in the multi-instance via a process variable In your case, ORDER_ITEM_SEQ looks like a good candidate.



Hi @Webcyberrob, thanks for you reply…

Yes, I can think in a couple of different approaches I could use to provide the process a “escape route” from that particular timer but, still, I believe there should be ways to find a job to manage it.

Now I want to stop a timer and advance the process but I guess someone could also want to change the definition to “slow it down”. Being able to manage jobs makes a lot of sense to me and getting the job’s context (specially the variables in that scope) should not be hard.

Anyway, changing the definition is not that simple since the running instances need to be migrated to the new version. :confused:

Should I consider there’s no other way to solve it but changing the model ? :frowning_face:


Its possible, but there’s lots of buts…

I say its possible, because if you think about it, via the console yo can modify a running instance, eg drag the token passed a current wait state. Hence perhaps the cockpit will meet your requirement.

To do it with your own code means understanding the intricate internals of the engine.



Well, I would really appreciate if you could give me some guidelines…

I already know how to trigger the job (I already do it when testing the process), just can’t find which job is the one I need to push but red button… :slight_smile:


I was going to say, looking at the rest API it looks like you can change the due date. To navigate to the job, given its a multi-instance you need to be aware of the following structure;

Process Definition->Process Instance->Execution

Hence consider retrieving the execution id of the multi instance by filtering based on the ORDER_ITEM_SEQ variable.

Refer This API reference

Now that you have the execution ID, lookup timer jobs for that execution

Refer this reference to get the job. Now that you have the job, ypu could change the due date to make it fire sooner…

Ive not tried this, but thats the approach I would take to start with…



That was exactly what I had in mind but the executionId of the variables don’t match any of the executionIds of the jobs…

I mean, I haven’t tried the rest API but the java API… But I don’t think I would get a different result, would I ? :thinking: