Fork me on GitHub

Available since 3.1.1.

Groovy Updater Execution Scheduler Job Module


Sometimes you write a Groovy Updater Script to do a batch job. Perhaps you also have wondered if it is possible to execute your Groovy Updater Script at midnight for example just by configuring a Repository Scheduler Job.

Unfortunately, there has been no easy way for that until you find this module! This Groovy Updater Execution Scheduler Job Module allows you to configure a Repository Scheduler Job to execute a Groovy Updater script based on your scheduler configuration.

Configuring a Groovy Updater Execution Scheduler Job

Suppose you want to execute a Groovy Updater script called "My Daily Documents Updater" at 04:00 am every day.

Then you can add a Repository Scheduler Job named "MyDailyDocumentsUpdaterJob" like the following example:

    jcr:primaryType: hipposched:jobgroup
      jcr:primaryType: hipposched:repositoryjob
      hipposched:attributeNames: [updatername]
      hipposched:attributeValues: [My Daily Documents Updater]
      hipposched:enabled: true
      hipposched:repositoryJobClass: org.onehippo.forge.utilities.repository.scheduling.UpdaterExecutingJob
        jcr:primaryType: hipposched:triggers
          jcr:primaryType: hipposched:crontrigger
          jcr:mixinTypes: ['hippo:lockable', 'mix:lockable']
          hipposched:cronExpression: '0 0 4 * * ?'
          hipposched:enabled: true

In the above example, the Repository Scheduler Job named "MyDailyDocumentsUpdaterJob" was added in a custom job group named "myjobgroup", instead of adding the job into the default "system" job group for clear separation.

Parameters can be passed to org.onehippo.forge.utilities.repository.scheduling.UpdaterExecutingJob by configuring hipposched:attributeNames and hipposched:attributeValues, each value of which properties must coupled with each other as name-value pair.

org.onehippo.forge.utilities.repository.scheduling.UpdaterExecutingJob requires updatername attribute which is associated with the name of the Groovy Updater Script to execute.