The XS job file .xsjob uses a number of keywords to define the job that must be run at a scheduled interval.
Example
{ "description": "Read stock value", "action": "yahoo:yahoo.xsjs::readStock", "schedules": [ { "description": "Read current stock value", "signature_version": 1, "xscron": "* * * * * * 59", "parameter": { "stock": "SAP.DE" } } ] }
{ "description": "Read stock value", }
The description keyword enables you define a text string used to provide context when the XS job is displayed for maintenance in the SAP HANA XS Administration Tool. The text string is used to populate the Description field in the SCHEDULED JOB tab.
{ "action": "myapps.finance.yahoo:yahoo.xsjs::readStock", }
{ "schedules": [ { "description": "Read current stock value", "xscron": "* * * * * * 59", "parameter": { "stock": "SAP.DE" } } ] }
The schedules keyword enables you define the details of the XS job you want to run. Use the following additional keywords to provide the required information:
- description (optional)
Short text string to provide context
- xscron
Uses cron-like syntax to define the schedule at which the job runs
- parameter (optional)
Defines any values to be used as input parameters by the (XSJS or SQLScript) function called as part of the job
{ "signature_version": 1, }
The signature_version keyword enables you manage the version “signature” of an XS job. You change the XS job version if, for example, the parameter signature of the job action changes; that is, an XS job accepts more (or less) parameters, or the types of parameters differ compared with a previous version of an XS job. On activation in theSAP HANA Repository, the signature of an XS job is compared to the previous one and, if the job’s signature has changed, any job schedules created at runtime will be deactivated.
Deactivation of any associated runtime job schedules prevents the schedules from silently failing (no information provided) and enables you to adjust the parameters and reactivate the job schedules as required, for example, using the enhanced XS JS API for schedules. Schedules defined in a design-time XS Job artifact are replaced with the schedules defined in the new version of the XS job artifact.
{
"schedules": [
{
"description": "Read current stock value",
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE"
}
}
]
}
The xscron keyword is used in combination with the schedules keyword. The xscron keyword enables you to define the schedule at which the job runs. As the name suggests, the xscron keyword requires a cron-like syntax.
The following table explains the order of the fields (*) used in the “xscron” entry of the .xsjob file and lists the permitted value in each field.
To prevent short-running jobs from restarting on completion, schedule the job to start at a specific second in the minute. For example, * * * * * */5 20 indicates that the scheduled job should run every five minutes and, in addition, at the 20th second in the specified minute. The job starts at precisely 20 seconds into the specified minute and runs only once.
The following table illustrates the syntax allowed to define expressions in the “xscron” entry of the .xsjob file.
{
"schedules": [
{
"description": "Read current stock value",
"xscron": "* * * * * * 59",
"parameter": {
"stock": "SAP.DE",
"share": "BMW.DE"
}
}
]
}
The optional parameter keyword is used in combination with the schedules keyword. The parameter keyword defines values to be used as input parameters by the XSJS function called as part of the job. You can list as many parameters as you like, separated by a comma (,) and using the JSON-compliant syntax quotations (“”).