cancel
Showing results for 
Search instead for 
Did you mean: 

Get JobId from BPMN Timer ID and Process Instance Id

filiphr
Champ in-the-making
Champ in-the-making
Hi,

I tried looking for an answer for this but I didn't manage to find one. I found this, which is similar but not quite the same, I also do not get the answer there. I know that the
jobHandlerConfiguration
field in
JobEntity
represents the ID of the Timer (please correct me if I am wrong). Is there some qay that I am not seeing to get the Jobs for a specific process instance and a specific timer.

I know that there is the possibility to create custom query and get what I need, but I want to rely on the provided API as much as I can.

Thank you in advance for your reply.
Filip
7 REPLIES 7

jbarrez
Star Contributor
Star Contributor
The jobhandlerconfiguration is not the id. It is used to store config values for a job and can be anything.

It could be that it is the correct id for the cases you are checking, but it is not the case for every job type.

The combination of timer id and process instance id is not in the query api available though…

filiphr
Champ in-the-making
Champ in-the-making
I suspected the same thing. I have seen the JobDefinitionEntity and you can actually get the Job if you have access to it.

Are there any plans for making a the JobDefinitionEntity querable and/or adding the combination for getting a job from the activityId/timerId into the JobQuery?

jbarrez
Star Contributor
Star Contributor
The job is queryable through the ManagementService., but it only has the filter on processInstanceId

filiphr
Champ in-the-making
Champ in-the-making
Yes, I know that the job is queryable through the ManagementService. My question was whether there are any plans in your pipeline to extend the filter for the job.

In the same time, whether there are plans to expose filtering the JobDefinitions

jbarrez
Star Contributor
Star Contributor
No nothing planned, as there are very little use cases for it. So if you have a solid use case you can described it will help a lot to understand what is needed.

filiphr
Champ in-the-making
Champ in-the-making
The use case would be something similar for the messages and signals. If you are able to query the jobs by the id of the timer you would be able to get the exact job you need. I cannot explain a lot, but imagine that one wants to execute a job only for a specific timer depending of it's ID, one reason for this can be when someone wants to bring a process Instance to a certain state by replaying some actions. It is better to manually execute the job than to mess with the System clock so the job is executed by the job executor. This can also be used for testing the business model if it behaves as it should be, for example if you have multiple active timers, but you want only one of them to be executed.

This is only my opinion, maybe you would disagree with me.

jbarrez
Star Contributor
Star Contributor
Yes i see. Although it would need to be implemented generically using the 'configuration' field (cause timer uses activityId, but other jobs don't).

It's already possible with a native query.

If you feel it's important, feel free to create a pull request.