Uploaded image for project: 'Bloomreach Forge'
  1. Bloomreach Forge
  2. FORGE-131

Simple generic scheduler job to execute a Groovy script

    XMLWordPrintable

Details

    Description

      Long time ago, my client asked me if it is possible to execute a groovy updater script at midnight. I said it's not supported yet. So, someone did that manually at midnight.
      So, I'm wondering now how we can support a scheduled task to execute a groovy updater script.

      One of the simplest solutions could be:

      • Add a generic scheduler job class: UpdaterExecutingJob.java.
      • An end project can configure a scheduler job with parameters specifying which updater script to execute like the following example:
      /hippo:configuration/hippo:modules/scheduler/hippo:moduleconfig/system/demoUpdaterExecutor:
        jcr:primaryType: hipposched:repositoryjob
        hipposched:attributeNames: [updatername]
        hipposched:attributeValues: [DemoUpdater]
        hipposched:enabled: true
        hipposched:repositoryJobClass: org.onehippo.forge...UpdaterExecutingJob
        /hipposched:triggers:
          jcr:primaryType: hipposched:triggers
          /nightly:
            jcr:primaryType: hipposched:crontrigger
            jcr:mixinTypes: ['hippo:lockable', 'mix:lockable']
            hipposched:cronExpression: 0 0 3 * * ?
            hipposched:enabled: true
      

      Then the generic scheduler job will push the configured updater, DemoUpdater in this case, to the updater queue, based on trigger configuration.
      They can optionally choose to use a simple trigger instead of cron trigger if they want to run it only once at a time.
      I think this will be very useful in many projects.

      Attachments

        Activity

          People

            Unassigned Unassigned
            wko Woonsan Ko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: