Timer boundary event(non-interrupt) only runs once?


#1

My problem is as follows I want to set a timer boundary event(non-interrupt) to send message to a recipient at two different times, one missing 10 days to finish the task deadline and another after the task deadline has expired, I do this by setting a date on a variable I set in the timer and after sending the first message I change this date to the deadline of the task, but he is only sending the first message the second is not going to look at the variable and it had its date changed as expected but when it arrives on this date he does not make any submissions. Does the timer boundary event(non-interrupt) run only once?

exemple


#2

Can you upload your model?


#3

Hi @MarceloCP,

As token reaches the user task with the attached timer boundary, a new job is created with due date set to the evaluated value of the variable used in the expression.

In other words, the expression of the time event will be evaluated as soon as the user task is created and changing the value of the process variable later will not trigger reevaluation process of the expression.

You still can update due date of created job using below rest api or equivalent java code

https://docs.camunda.org/manual/latest/reference/rest/job/put-set-job-duedate/

And easy solution would be to use 2 attached timers as in below model using two different variables


#4

Good afternoon Niall, I think I found a solution, I changed from non-interupt to the normal that interrupts the task and viz a loop to return to the same task but now the timer date changed and at first it worked. thank you

exemple


#5

Hi Hassang.

I’ve done it this way you did, but when you have some rules that didn’t work very well, because tasks can be created after the deadline of ten days before it has passed but the deadline has not yet finished so you would only have to send a message of deadline after the date expires, but in this case he sends both messages to the expired date and also that ten days are left. Thanks, I put a solution that can fit me in a loop.


#6

Hi @MarceloCP,

May we know your use case? Because I couldn’t figure it out.
Did you try my solution with 2 different date variables, one for each timer?


#7

I am now testing this solution of yours because the way I did to loop to receive the same email several times even changing the date of the variable. Soon the result


#8

With two timer even having set different variables I get the same email twice, I will send my bpmn stream

p01-monitoramento.bpmn (9.7 KB)

java class send email

public class Notificar implements JavaDelegate {

private String numProcesso;
private String corpoMenssagem;
private String assunto;
private String[] para = new String[2];
private String tipo_notificacao;
	
@Override
public void execute(DelegateExecution ex) throws Exception {
	String tipo = (String) ex.getVariable("tipo_processo");
	String dataPrazo = (String) ex.getVariable("data_prazo");
	para[0] = (String) ex.getVariable("email_comissao");
	para[1] = (String) ex.getVariable("email_gestor");
	numProcesso = (String) ex.getVariable("num_processo");
	if (tipo.equals("TC")) {
		tipo_notificacao = (String) ex.getVariable("tipo_notificacao");
		if(tipo_notificacao.equals("a_vencer")) {
			corpoMenssagem = "Informamos que o prazo para conclusão do processo de Tomadas de Contas Especial, número "+numProcesso+", vence em "+dataPrazo+", conforme previsto no Art. 5° §2° do decreto 1886/2013.\n" + 
					"Atenciosamente,\n" + 
					"Controladoria Geral do Estado\n" + 
					"cgesc@cge.sc.gov.br\n" + 
					"Tel (48) 3664-5720\n" + 
					"Este e-mail não pode ser respondido";
			assunto = "Prazo à vencer - TC número "+numProcesso;
			ex.setVariable("tipo_notificacao", "vencido");
		}else {
			corpoMenssagem = "Informamos que o prazo para conclusão do processo de Tomadas de Contas Especial, número "+numProcesso+", conforme previsto no Art. 5° §2° do decreto 1886/2013.\n" + 
					"Atenciosamente,\n" + 
					"Controladoria Geral do Estado\n" + 
					"cgesc@cge.sc.gov.br\n" + 
					"Tel (48) 3664-5720\n" + 
					"Este e-mail não pode ser respondido";
			assunto = "Prazo vencido em TC "+dataPrazo;
		}
	}else {
		tipo_notificacao = (String) ex.getVariable("tipo_notificacao");
		if(tipo_notificacao.equals("a_vencer")) {
			corpoMenssagem = "Informamos que o prazo para conclusão do processo de Providências Administrativas, número processo "+numProcesso+", vence em "+dataPrazo+", conforme previsto no Art. 5° §2° do decreto 1886/2013.\n" + 
					"Atenciosamente,\n" + 
					"Controladoria Geral do Estado\n" + 
					"cgesc@cge.sc.gov.br\n" + 
					"Tel (48) 3664-5720\n" + 
					"Este e-mail não pode ser respondido";
			assunto = "Prazo à vencer PA número "+numProcesso;
			ex.setVariable("tipo_notificacao", "vencido");
		}else {
			corpoMenssagem = "Informamos que o prazo para conclusão do processo de Providências Administrativas, número "+numProcesso+", encerrou. Conforme previsto no Art. 5° §2° do decreto 1886/2013.\n" + 
					"Atenciosamente,\n" + 
					"Controladoria Geral do Estado\n" + 
					"cgesc@cge.sc.gov.br\n" + 
					"Tel (48) 3664-5720\n" + 
					"Este e-mail não pode ser respondido";
			assunto = "Prazo vencido em PA número "+numProcesso;
		}
	}
	for(int i=0;i<2;i++) {
		EnviarEmails informar = new EnviarEmails();
		informar.envio(para[i], assunto, corpoMenssagem);
	}
	
}

#9

I can understand what is happening, I get two emails ie it executes both timers if even if the date of the variable has passed. How can I not run the timer if the date in the variable has passed?


#10

Hi @MarceloCP,
If you could explain your use case in details it would be better…


#11

I already understand what is happening if the dates of the variables are past dates. ex variable1 (2019-08-07) and variable2 (2019-08-29) it will execute both the timer of variable2 which is today and that of variable1 since it is a date that has passed.
How would you override the timer if the variable’s date is in the past?


#12

Hi @MarceloCP,

You can make your outgoing sequence flows conditional sequence flows.
Where you set conditions such as variable1 > now() and variable2 > now().


#13

It worked, there was an error in my coding when informing the values ​​of the variables. So summarizing the solution is to put two timer boundary (non-interrupt) with different variables. Thanks for the help and patience.