Specifying timer event - Scheduling

Hello team,

I have a requirement where user can specify a schedule for a process definition. I saw examples for the following:

  • Specify a recurring interval (using CRON)
  • specify a start date

But I am looking for a way to specify a schedule in such a way that the first run can also be set - like run the workflow every hour starting July 1 2019.

TIA.

Hi @deepu.v87,

I am not sure if that would be helpful for your case

You can have your model initially suspended and defined with a start event timer set to work every hour using CRON.

And define another simple model with only one service task where you have code to activate your main suspended model. This simple model would has a start event timer set to work on specific time “for example: July 1 2019”.

This way your simple model would play the role of activating your suspended main model only on the specified time defined on it’s start event timer.

I came across a setter on the RepositoryService.

repositoryService.createDeployment()
.addInputStream(resource.getOriginalFilename(), resource.getInputStream())
.tenantId(tenant.getId())
.enableDuplicateFiltering(true)
.source(processDefinitionFileSource)
.activateProcessDefinitionsOn(date)
.deployWithResult();

Will this work?

I still have to test this piece of code with some samples.

1 Like

Hi @deepu.v87

Interesting finding… It should works…

I tried deploying workflows several times with different activation dates. The process definition remains active itself. Looking into the code there are sections where the process definition is suspended and then there is a schedule being set (DeployCmd.scheduleProcessDefinitionActivation()). But somehow it is not working for me. I am not sure if I am doing something wrong here.

Any help in this regard is greatly appreciated.

TIA.

Hi @deepu.v87

Maybe you have a previous bpmn version already deployed and you are trying to deploy the same one without any changes.
And as you set enableDuplicateFiltering to true then no new deployment would be done.

Try setting enableDuplicateFiltering to false

I delete the process definitions and deploy again. So it has nothing to do with versioning. I still see version 1 for my deployments. I see records created in act_hi_job_log table with job_def_type as activate-processdefinition and job_deu_date as 2016-06-27 13:20:00. But still not working as expected.

Hi @deepu.v87

You said

job_deu_date as 2016-06-27 13:20:00

Which is a past date. You should test with a future date…Otherwise it would be deployed and activated immediately because the specified due date is already in the past.

1 Like

Oops. nice catch. Thanks. Let me try with a date in 2019. I completely missed out on 2016. My bad.

**EDIT
It worked like a charm. OMG!! You really saved my day :slight_smile:
Thanks much