Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
CarlosRoggan
Product and Topic Expert
Product and Topic Expert
This series of blogs intends to show in an easy way how to use the Job Scheduler service in SAP Cloud Platform

In this first blog, we’re going to prepare ourselves before we start with a first example


Overview



What's that: Job Scheduler?


It is a tool.
It allows to define jobs in SAP Cloud Platform
A job can be configured to run regularly, or just once
A job triggers an action

What is it not?

Job Scheduler is not a framework
It doesn't help to create the actions which should be executed
It's just a tool to trigger anything which already exists

How does it work?

Job Scheduler is a cloud service in SAP Cloud Platform
There’s a Dashboard which allows to define jobs
A job is configured with a URL
This means your job would invoke that URL e.g. every night
A job can as well be configured with a CloudFoundry-Task

How does it work technically?

You have an application in SAP Cloud Platform
You add a REST endpoint to your app, which can be invoked and which does something
You bind your app to an instance of Job Scheduler service
Now you can configure Job Scheduler to call this endpoint every night (or whatever)
The result of the HTTP call is evaluated by Job Scheduler

More details please?

Job Scheduler requires that you bind your app also to an instance of xsuaa service (Authorization and Trust Management)
Note: the order of binding is relevant !



Which Features does it have ?

Job Scheduler functionality of triggering actions (It doesn’t help to define such actions)
User Interface to create jobs and define schedules, to view results, etc
Interface to manage jobs/schedules via API (REST, node.js, Java)
Details:
Support for Cloud Foundry tasks
Schedules can be defined with cron or human readable format
Jobs can run synchronously or asynchronously
2 Service plans: 'lite' and 'standard'

What's the difference between both service plans ?

Service Plan 'lite'
Is only intended to be used in trial landscape.
Allows to create multiple jobs (or Cloud Foundry "Tasks") with minimum schedule frequency of an hour (Non Productive usage).
Supports HTTP REST endpoints to be triggered by a job
Supports as well Cloud Foundry "Tasks"
Allows 15 schedules.

Service Plan 'standard'
Minimum schedule frequency is 5 minutes.
Support for multitenancy
OAuth2 for REST API

Service Plan 'service'
Don't use
Deprecated since long time -> do nut use
Will be removed in the future -> so better not use
Remember: It should not be used

Note:
In case you face problems with display of Job Scheduler Dashboard:
Are you using old Microsoft browser?
Background:
Newer UI5 versions (from 1.88) don’t support the legacy browsers IE11 and Edge Legacy (Edge HTML) anymore (more info)
To solve the problem, you should use modern browser

Preparation


If you want to use Job Scheduler in SAP Cloud Platform, you need to create 2 service instances

Create instance of Job Scheduler service

Creating an instance of the Job Scheduler service is anyways the first step do do
It can be reused by all required applications

In SAP Cloud Platform, Cloud Foundry Environment, (Trial) go to your Space and open the Service Marketplace
Find the tile “Job Scheduler”

Note: if you don’t see the Job Scheduler in the Service Marketplace, you need to configure Entitlements. See Appendix

Click the tile Job Scheduler -> Instances -> New instance
Choose Service Plan as 'lite' (anyways, in Trial, only 'lite' is supported)
Parameters: fill in the following into the text field :
{
"enable-xsuaa-support": true
}

It looks like this:



Step through the wizard and provide an instance name of your choice, e.g.  jobschedulerinstance

Note:
The configuration parameter enable-xsuaa-support is always required, unless you want to trigger only CF Tasks (no REST endpoints)

 

Create instance of xsuaa service

After creating the service instance of Job Scheduler, the next task to do is creating an instance of Authorization and Trust Management (XSUAA)

However, this instance requires configuration which is a bit specific to the use case.
As such, it will be described later

Only one info: You should use service plan 'broker'

Note:
If you already have a XSUAA instance that is bound to your application then you can also re-use it and bind it to the Jobscheduler. It might require the update-service command

 

Summary


In this blog, we've learned that Job Scheduler is a tool which can trigger actions,
e.g. invoke REST endpoints.
It can be configured to do that on e.g. regular basis

To use Job Scheduler, you need and application (with endpoint) and you have to bind it to service instances of JobScheduler and XSUAA
And remember that the order is important (order of creation and binding)

Next Steps


Recommended readings:
Part 1: First simple use case in Trial account
Part 3: Simple use case with authentication and authorization
Part 5: Long-running operations (async jobs)
Part 6: Troublemaking (get little help for 403 error)

See links section in the overview blog post.

Appendix: How to Configure Entitlements



  • Go to your global account, e.g. P123456789trial

  • Click on Entitlements in the left menu pane

  • Click on Entity Assignments

  • Select in SubAccounts in the DropDownbox e.g. ‘Trial’

  • Click on ‘Go’

  • Click on ‘Configure’

  • Afterwards one click on "Add Service Plans"

  • In the dialog you can search for Job Scheduler

  • Select Checkbox ‘lite’  (Available service plans)
    If the allowed service plan is grayed-out, then you might need to remove from other subaccount or, in productive environment, purchase quota

  • Click on Button ‘Add 1 ServicePlan’

  • Don’t forget to click on ‘save’

  • Go back to the Service market place you should see the Job Scheduler Tile

20 Comments