TimerBoundaryEvents & new job in ACT_RU_JOB table

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
mlody
Member II

TimerBoundaryEvents & new job in ACT_RU_JOB table

Hi all,

I have following business case:

User wants to receive notifications N days before particular task due date. Moreover, there is possibility to change due date from application.

So, I've created user task and timer boundary event, which is connected with it. Everything works fine - when user task is active in process, notification is sent to the user on calculated date based on process variable. However, timer boundary event does not finish user task. In this case, when timer boundary event is fired and job is completed, user can change due date in application and expects next notification N day before new due date. Unfortunately, when user changes due date, new job is not created. I suppose I have to create it manually, but API does not allow such kind of operation. I am able to do it by direct iBatis call:

dbSqlSession.getSqlSession().insert("insertTimer", timerEntity);

It is not good solution. Could you please help me with this case? Thank you in advance.

2 Replies
gdharley
Intermediate

Re: TimerBoundaryEvents & new job in ACT_RU_JOB table

Assuming you have the TimerEntity definition, have you tried:
import org.activiti.engine.impl.context.Context;

...

...

Context.getCommandContext().getJobEntityManager().schedule(myTimerEntity);

Ultimately it does the same thing you are doing, but you aren't making an explicit iBatis call.

Let me know how it goes.

Greg

P.S. Id be interested in how you are retrieving/constructing the TimerEntity since it will be gone as soon as the timer fires.

kitkatboy
Member II

Re: TimerBoundaryEvents & new job in ACT_RU_JOB table

Thank you for your response.

I figured it out and it works now. For new timers (jobs) I use:

commandContext.getJobEntityManager().insert(timerEntity);