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 https //example com/trigger https //example com/trigger 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 { "endpointurl" "https //example com/trigger", "signaturekey" "abcdefghijklmnopqrstuvwxyz0123456789", "payload" { "key1" "value1" }, "startdate" "2023 09 30", "enddate" "2023 09 30", "cron" " " } sample response the following is an example response showing the new schedule { "schedule" { "scheduleid" "schedule 89d03717 b21f 49bc b3c9 cd1924cee5a2", "tenantid" "os1devs", "endpointurl" "https //example com/trigger", "signaturekey" "abcdefghijklmnopqrstuvwxyz0123456789", "payload" { "key1" "value1" }, "startdate" "2023 09 30", "enddate" "2023 09 30", "appid" "dispatch fpa", "cron" " ", "isactive" true }, "error" {} } 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