cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Job ID in timed process

hyapit
Champ in-the-making
Champ in-the-making
Hello,

I have a TimerDefinition in my process definition, which will create a Job instance when the process definition is deployed. I would like to set the processDefinitionID column AND/OR jobID column of the Job Table to an ID of my choosing. How should I go about achieving that?

I tried the "id" XML tags of timerDefinition and timeCycle tag, but they don't seem to be hooked up to the columns I'm interested in.

Ideally, I'd like to be able to set these values before the Job instance is created, i.e. before the process definition is deployed.

Thoughts? Advice?
11 REPLIES 11

trademak
Star Contributor
Star Contributor
That's not possible, the job id is a db sequence identifier. Why would you want to do that? You can use the job query to get the job based on your process definition id.

Best regards,

hyapit
Champ in-the-making
Champ in-the-making
I need to associate a process definition to a Job ( a TimerEntity ). I'm using a timerDefinition tag, which creates a TimerEntity with process definition id NOT set ( is this not expected? ).

As I mentioned, setting process definition id would be perfect. Advice on how to do this Tijs?

frederikherema1
Star Contributor
Star Contributor
The process definition key is stored in the "configuration_" column. Also, the process-definition ID should be set when the process is deployed:


TimerEntity timer = timerDeclaration.prepareTimerEntity(null);
        timer.setProcessDefinitionId(processDefinition.getId());
        Context
          .getCommandContext()
          .getJobEntityManager()
          .schedule(timer);

If this is not the case, can you create a unit-test that points out the NULL value?

Frederik,

I was interested in setting the processDef ID from my bpmn20 xml, since my timer definition is part of a larger BPMN xml.

I'd like to set process definition ID before the TimerEntity is kickstarted when the process definition is deployed.

Thoughts?

jbarrez
Star Contributor
Star Contributor
Why would you want to do that? What do you mean with 'larger BPMN xml' … do you mean you compose different XML's?

beearn
Champ in-the-making
Champ in-the-making
I was interested in setting the processDef ID from my bpmn20 xml, since my timer definition is part of a larger BPMN x 

hyapit
Champ in-the-making
Champ in-the-making
re: why would I want to do that?

because I need to associate a timerEntity with a particular process definition. Starting a TimerEntity using timerDefinition tag leaves "processDefinitionId" of the Job null.

re: what I mean by larger XML?
what I really meant was I have a complex process definition and needed to start a timerEntity somewhere in the middle of the process. I was hoping there's a way to set processDefinitionId from within the XML as I find it to be the most trivial solution if supported. From your reaction there seems to be no way to do this from the XML. I'm going to explore using "ExecutionListener" and use the solution Frederik suggested.

Thanks guys!

jbarrez
Star Contributor
Star Contributor
A timer in a process is always attached to the process instance it was created from.

But I still don't get it: you want to set a timer on a process definition … what does that even mean? What is the use case you try to solve?

jbarrez
Star Contributor
Star Contributor
A timer in a process is always attached to the process instance it was created from.

But I still don't get it: you want to set a timer on a process definition … what does that even mean? What is the use case you try to solve?