@zcatalyst/job-scheduling
v0.0.3
Published
JavaScript SDK for Catalyst Cron - Scheduled Job Execution
Downloads
186
Maintainers
Readme
@zcatalyst/job-scheduling
JavaScript SDK for Catalyst Cron - Scheduled Job Execution
Overview
The @zcatalyst/job-scheduling package provides JavaScript/TypeScript methods to manage Catalyst Cron, job pools, and jobs. Runs in Node.js (server-side) environments only.
Prerequisites
- A Catalyst project set up
- Job Pools — must be created before the execution
- Understanding of cron
Installation
To install this package, simply type add or install @zcatalyst/job-scheduling using your favorite package manager:
npm install @zcatalyst/job-schedulingyarn add @zcatalyst/job-schedulingpnpm add @zcatalyst/job-scheduling
Getting Started
Import
The Catalyst SDK is modularized by Components.
To send a request, you only need to import the JobScheduling:
// ES5 example
const { JobScheduling } = require('@zcatalyst/job-scheduling');// ES6+ example
import { JobScheduling } from '@zcatalyst/job-scheduling';Usage
To send a request, you:
- Create a JobScheduling Instance.
- Call the JobScheduling operation with input parameters.
const jobScheduling = new JobScheduling();
const data = await jobScheduling.JOB.getJob('124567890');Async/await
We recommend using await operator to wait for the promise returned by send operation as follows:
// async/await.
try {
const data = await jobScheduling.JOB.getJob('124567890');
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}Error Handling
try {
const data = await jobScheduling.JOB.getJob('124567890');
// process data.
} catch (error) {
const message = error.message;
const status = error.statusCode;
console.log({ message, status });
}Resources
Contributing
See CONTRIBUTING for more information on how to get started.
License
This SDK is distributed under the Apache License 2.0. See LICENSE file for more information.
