arrow-down
    1. Overview
    2. Core concepts
    3. Using docs
    4. Intro Videos
    5. Tutorials
    1. Intro
    2. GraphQL API
    3. Media API
    4. Extending the API
    5. Component API
    1. Content Studio
      1. Branches
    2. Layers
      1. Lifecycle
      2. Media
      3. Attachments
      4. X-data
        1. Page templates
        2. Fragments
      5. Variants
      6. Permissions
      7. Versions
    3. Sites
      1. Visual editor
    4. Publishing
    1. Introduction
      1. Controllers
      2. Globals
      3. Events
      4. HTTP Request
      5. HTTP Response
      6. Error handler
      7. Filters
      8. Templating
      9. Localization
      10. Websocket
      11. Tasks
      12. Main controller
      13. Java bridge
      1. Admin Lib
      2. Application Lib
      3. Auditlog Lib
      4. Authentication Lib
      5. Cluster Lib
      6. Common Lib
      7. Content Lib
      8. Context Lib
      9. Event Lib
      10. Export Lib
      11. Grid Lib
      12. I18N Lib
      13. IO Lib
      14. Mail Lib
      15. Node Lib
      16. Portal Lib
      17. Project Lib
      18. Repo Lib
      19. Scheduler Lib
      20. Schema Lib
      21. Tasks Lib
      22. Value Lib
      23. VHost Lib
      24. Websocket Lib
    2. Other Libraries
      1. CLI
      2. Sandboxes
      3. Code
      4. Building
      5. Configuration
      6. TypeScript
    3. Building APIs
      1. Mappings
      2. Components
      3. Processors
      4. Contributions
    4. Building Webapps
      1. ID providers
      2. Admin Apps
      3. Admin Widgets
    1. Architecture
      1. TODO
      1. Navigating
      2. Users
      3. Applications
      4. Data management
      5. System info
      6. Audit Logs
      7. Task management
      1. Portal
      2. IDprovider
      3. Management
      4. Statistics
      1. Nodes and repos
      2. Properties
      3. Indexing
      4. Branches
      5. Editors
      1. DSL Queries
      2. NoQL Queries
      3. Filters
      4. Aggregations
      5. Highlighting
      1. ID providers
      2. System ID provider
      3. Users and groups
      4. Roles
      1. Strategies
      2. Distributions
      3. Docker
      4. Kubernetes
      5. Systemd
      6. Vhosts
      7. Configuration
      8. Backup & restore
      9. Clustering
      10. Observability
      1. Notes
      2. Upgrade
      3. Upgrading Apps
        1. Asset service
        2. HTTP service
        3. Image service
    1. Best practice
        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
      1. Mixins
      2. Localization
      3. Styles
    2. Content Types
    3. X-data
    4. Macros
      1. Pages
      2. Regions
      3. Part component
      4. Layout component
      5. Text component
      6. Component Filtering
      7. Component Indexing
    1. Marketplace
    2. Market guidelines

Scheduler

Contents

XP 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