You are viewing the documentation for Blueriq 16. Documentation for other versions is available in our documentation directory.

Introduction

It might happen that after a model is defined and some tasks/jobs are already created, one decides to change the model. In this case it might be needed to update the already created tasks and jobs according to the new model definition.

Blueriq runtime supports this functionality in the process engine initialization phase. Moreover, this functionality can be turned on or off by defining a setting in your application-scheduler-quartz.properties.properties file.

Property

In order to be able to handle model changes we provide a setting. Set this to true in order to enable the functionality.

 
By default updates on tasks and jobs are not supported when the model changes, false is the default value for this setting.
application-scheduler-quartz.properties
blueriq.scheduler-quartz.handleModelChanges=true

Description

Algorithm

Below you can find the algorithm we use to update the tasks and jobs based on the model change. The code will be executed at every process engine initialization only if blueriq.scheduler-quartz.handleModelChanges is set to true. 

  1. Get all tasks from the database which: are of type 'wait' (timer tasks), have a timeout date (expiration task), are of type 'task' and are started or open (these might have a priority algorithm defined).
  2. For each task get the process node definition (process node definition is based on the model).
  3. If process node definition contains a timer, expiration or priority algorithm definition calculate the new date time from the expression based on the task's creation date.
    1. For timer expression calculate the new start date of a task.
    2. For expiration expression calculate the new timeout date of a task.
    3. For priority algorithm calculate the new start date of the priority algorithm reevaluation time.
  4. Based on the task get the existing job from the scheduler.
  5. If the job data contains a different expression than the one from the process node definition(step 3), reschedule the job based on the date calculated in step 3.
  6. If job was rescheduled at step 5, update the task in the database accordingly. (For timers update the task's start date, for expiration update the task's timeout date)

Date time calculation Scenarios

  1. If expression contains NOW or TODAY, date will be calculated based on the task's creation date.
    If task was created on 2018.03.15 with expression NOW + 3 DAYS which evaluates in 2018.03.18. On 2018.03.16 you change the expression to NOW + 2 DAYS and reinitialize the process engine. The new date will be evaluated to 2018.03.17(based on task creation date = 2018.03.15) and the job will fire on that day.
  2. If expression contains an Entity with an attribute expression which contains NOW or TODAY, date will be calculated based on the system's current date.
    If task was created on 2018.03.15 with expression 'Entity.attribute + 3 DAYS', where 'attribute' is an expression 'NOW', this evaluates in 2018.03.18. On 2018.03.16 you change the expression from the attribute to NOW + 1 DAYS and reinitialize the process engine. The new date will be evaluated to 2018.03.17 (based on the current date = 2018.03.16)and the job will fire on that day.
  3. If expression contains DATEVALUE, DATETIMEVALUE or any other definition which is not calculated based on the system's current date, it will evaluate in the that concrete day in the future.
  4. If expression contains an Entity with an attribute which contains DATEVALUE, DATETIMEVALUE, the jobs will not be updated with the new expression because we can not detect the change in the attribute.

  • No labels