arrow-down
    1. Widgets
  1. IAM
    1. Virtual apps
    1. Projects
    2. Layers
        1. AttachmentUploader
        2. Checkbox
        3. Combobox
        4. ContentSelector
        5. ContentTypeFilter
        6. CustomSelector
        7. Date
        8. DateTime
        9. Double
        10. GeoPoint
        11. HtmlArea
        12. ImageSelector
        13. Long
        14. MediaSelector
        15. Radiobutton
        16. Tag
        17. TextArea
        18. TextLine
        19. Time
      1. Field set
      2. Item set
      3. Option set
      4. Mixins
      5. Localization
    3. Content Types
    4. X-data
    5. Macros
    6. Custom styles
    7. Sites
      1. Regions
      2. Part component
      3. Layout component
      4. Text component
      5. Fragments
      6. Filtering
      7. Component indexing
      8. Visual editor
    8. Page templates
    1. Sandboxes
    2. Code
    3. Building
    4. Configuration
    1. Globals
    2. HTTP
    3. Controllers
    4. Filters
    5. Events
    6. Websocket
    7. Error handler
    8. ID provider
    9. Tasks
    10. Localization
    11. Mappings
    12. Components
    13. Processors
    14. Contributions
    15. Templating
    16. Main controller
    17. Java bridge
      1. Webapp Engine
        1. Image service
        2. Component service
      2. Admin Engine
      3. Asset service
      4. HTTP service
      5. IDprovider service
    1. Task engine
    2. Management Endpoint
    3. Statistics Endpoint
    1. Nodes and repos
    2. Properties
    3. Indexing
    4. Branches
    5. Queries (NoQL)
    6. Queries (DSL)
    7. Filters
    8. Aggregations
    9. Highlighting
    10. Editors
    1. Strategies
    2. Distributions
    3. Docker image
    4. Vhosts
    5. Configuration
    6. Backup & restore
    7. Systemd
    8. Clustering
    1. Admin API
    2. Application API
    3. Auditlog API
    4. Authentication API
    5. Cluster API
    6. Common API
    7. Content API
    8. Context API
    9. Event API
    10. Export API
    11. Grid API
    12. I18N API
    13. IO API
    14. Mail API
    15. Node API
    16. Portal API
    17. Project API
    18. Repo API
    19. Scheduler API
    20. Schema API
    21. Tasks API
    22. Value API
    23. VHost API
    24. Websocket API
  2. Audit Logs
    1. Upgrade Notes
    2. Upgrading Apps

Scheduler

Contents

XP XP 7.7.0 7.7.0

Named tasks can be scheduled by XP platform to asynchronously run in the background in a cluster or a one-node environment.

Scheduled Job

A scheduled job is an object which describes how a named task must be run. It contains information about the type of scheduling, time of execution, description, etc. All job nodes are stored in a separate system.scheduler repository. See how to manipulate it with lib-scheduler API.

Properties

Name Type Description

name

string

Name of a job, unique for the entire environment

description

string

String-format description of scheduled job

descriptor

string

Descriptor of the task to be scheduled. Format: <applicationKey>:<taskName>

config

object

JSON object contains described task parameters

calendar

object

Describes when the task should run

Properties
Name Type Description

value

string

schedule value according to its type

type

string

schedule type (CRON to be executed repeatedly or ONE_TIME to be executed once)

timezone

string

time zone of cron scheduling. It doesn’t apply to a onetime calendar.

user

string

Principal key of the task submitter. Format: <idProvider>:<user>

enabled

boolean

If true - the job is active and can be run according to it’s cron value and timezone.

creator

string

Principal key of user that created the task

modifier

string

Principal key of the last user that modified the task

createdTime

string

Time of the task creation

modifiedTime

string

Time of the last task modification

lastRun

string

Time of the last job run

lastTaskId

string

Task id of the last job run

Calendar

Calendar object describes when and how the task should be run. There are two possible types: one-time and cron.

one-time

The task will be run only once. If the time value is passed at the moment of scheduling, then the task will be run immediately. Value format is ZULU time, documented in ISO 8601.

Example of a one-time calendar
{type: 'ONE_TIME', value: '2021-01-01T10:30:00.00Z'}
cron

Should be used for repeatable tasks. UNIX cron lib format is expected. Also, a timezone must be specified to run the job at a particular time of the day.

Example of a cron calendar
{type: 'CRON', value: '* * * * *' // every minute
,timeZone: 'GMT+5:30'}

Configuration

There are two ways to configure custom scheduled jobs: lib API provides methods to manipulate jobs and config file is used to configure default permanent cron jobs.

System jobs

XP platform provides predefined system jobs, which can be enabled and overridden by user in config file. Config modification doesn’t update job nodes automatically, so make sure you’ve removed or changed old job nodes manually before any config change.

Vacuum

Deletes unused blobs and binaries from a blobstore.

Make sure you have a backup of the installation available before doing a vacuum.
Predifined vacuum job properties
init-job.vacuum.enabled=false
init-job.vacuum.cron=0 5 * * *
init-job.vacuum.descriptor=com.enonic.xp.app.system:vacuum
init-job.vacuum.description=Job to run vacuum
init-job.vacuum.user=system:su

Common vacuum process config can be found in Vacuum config file.

Audit log cleanUp

Deletes records from audit log repository.

Make sure you have a backup of the installation available before running a cleanUp.
Predefined cleanUp job properties
init-job.audit-log-cleanup.enabled=false
init-job.audit-log-cleanup.cron=0 5 * * *
init-job.audit-log-cleanup.descriptor=com.enonic.xp.app.system:audit-log-cleanup
init-job.audit-log-cleanup.description=Job to clean up old audit log history
init-job.audit-log-cleanup.user=system:su

Common cleanup process config can be found in Audit config file.

ageThreshold property must be set to appropriate value, otherwise nothing will be removed.

Distributable

XP platform guarantees that a scheduled job won’t be executed by multiple threads concurrently for the cluster environment.

Several jobs can describe the same task descriptor, so the same code can be run by different threads simultaneously. Also, if the execution time of the task is longer than the cron period (especially important for long-term jobs) then a new task can be started before the previous is finished.

A scheduled job can be executed by any cluster node supporting an application, which contains the described task. See task for further explanation.


Contents

Contents

AI-powered search

Juke AI