OS1 Services

Scheduler Service

10min

Overview

The scheduler service offers you a powerful interface for managing scheduled jobs. It eliminates the need for developers to build their own proprietary scheduling services by providing a comprehensive scheduling solution with CRUD operations and a range of scheduling functionalities.

The Scheduler Service enables applications to:

  • Create one-time or recurring jobs based on absolute times or time intervals.
  • Specify essential details like endpoint URL, signature key, external ID, payload, and number of retries.
  • Receive notifications upon job completion to keep you informed of each job's status and enhance your workflow.
  • The service supports up to 100,000 active jobs per application and allows scheduling up to 10 years in advance, emphasizing flexibility and scalability.

Common Use Cases

The Scheduler Service is versatile and finds utility across several use cases, as outlined below:

  • Contracts: Automatically mark contracts as inactive after their end date. When you need to manage contracts, imagine a system that automatically marks them as inactive once they hit their end date. This way, you can focus on what really matters, without the hassle of outdated agreements cluttering your workspace.
  • Indents: Implement timeout protocols for unplaced or unaccepted indents. When you're managing order requests, imagine having a system that automatically cancels any that aren't accepted or completed in a timely manner. This keeps your workflow smooth and prevents unnecessary delays.
  • Trips: Schedule regular ETA calculations to identify delayed trips. When you're tracking trips, think about scheduling regular ETA calculations. This allows you to quickly spot any delays, so you can adjust plans and keep everything on track.
  • Vehicles: Update vehicle data based on government records for expiring insurance or registration. When it comes to vehicle management, envision a system that updates vehicle data based on government records. You’ll receive reminders for expiring insurance or registration, saving you from potential compliance issues.
  • Invoicing: Automate the aggregation of charges and daily computation of usage-based billing. When you’re automating invoicing, consider how the Scheduler Service can help you gather charges and compute daily usage-based billing effortlessly. This means less time spent on paperwork and more time focusing on your projects.

Using Scheduler Service

This section explains how to use the Scheduler Service, including key operations for managing scheduled jobs.

To utilize the Scheduler Service, follow these steps:

  • Create a Schedule: Use the CreateSchedule API to schedule a one-time or recurring job.
  • Retrieve Schedules: Fetch details of a job or list all scheduled jobs using GetSchedule or ListSchedules.
  • Update a Schedule: Modify the attributes of an existing schedule using UpdateSchedule.
  • List Executions: Use ListExecutions to view completed jobs and their statuses.

This service is optimized to balance between flexibility and scale, supporting a quota of 100K active jobs per application and scheduling jobs 10 years into the future. Additionally, it fosters a seamless workflow by providing notifications upon job completion, detailing the status of each job.

Configuration Parameters

The following parameters are used to create a schedule with specified start and end dates:

Parameter

Data Type

Description

Example

endpointUrl*

string

The URL to trigger the action.

signatureKey*

string

The key used for signing the request

abcdefghijklmnopqrstuvwxyz0123456789

payload

object

The payload to send in the request

OrderedMap { "key1": "value1" }

startDate*

string

The start date for the scheduled job

2023-09-30

endDate

string

The end date for the scheduled job

2023-09-30

cron*

string

The cron expression for the recurring job

* * * * *

Key APIs

  • CreateSchedule - Use this endpoint to schedule a one-time or recurring job.
  • GetSchedule - Use this endpoint to fetch details of a job by its ID.
  • ListSchedules - This endpoint provides a list of jobs, filtered by time range and status.
  • UpdateSchedule - Update the details or schedule of a future job using this endpoint.
  • ListExecutions - Use this endpoint to list completed jobs sorted by their status and the time range.

Example Usage

Sample Request

Create a Schedule

Below is a sample JSON request body to create a schedule:

Example JSON Request Body

Create a Schedule


Sample Response

The following is an example response showing the new schedule:

JSON


Limitation

When integrating with the Scheduler service, app developers must ensure their endpoint URL is optimized for quick response. The endpoint should be capable of returning a 2XX HTTP status code within 1000 milliseconds (1 second) to confirm successful execution. Should the service not receive a 2XX status within this timeframe, it is programmed to initiate a sequence of retries to ensure delivery. Here’s how the retry mechanism is structured:

5XX Responses: If a 5XX server error response is returned, indicating a server-side error, the Scheduler service will initiate a maximum of three retries. The retries are scheduled as follows:

  • First Retry: 1 second after the initial attempt.
  • Second Retry: 2 seconds after the first retry.
  • Third Retry: 3 seconds after the second retry.

3XX and 4XX Responses: In cases where the endpoint responds with a 3XX redirection or 4XX client error status, the Scheduler service will not attempt a retry. 

Reference Documentation

For detailed information on the Scheduler Service APIs, including endpoints, request/response formats, and additional configuration options, refer to the API documentation.