Create Job
Using the following SDK method, you can create and submit Jobs to trigger Job Functions, Webhooks, Circuits, and App Sail services. You can also pass optional arguments in the form of JSON key value pairs.
SDK snippet to create and submit Job to trigger:
Ensure the following packages are imported:
copy
import com.zc.component.jobscheduling.beans.job.ZCJobMetaDetail; import com.zc.component.jobscheduling.beans.job.ZCJobBuilder; import com.zc.component.jobscheduling.beans.job.ZCJobDetails; import org.json.simple.JSONObject;
copy
// generate function job meta ZCJobMetaDetail jobMeta = ZCJobBuilder.functionJobBuilder() // get function job builder .setJobConfig(2, 15 * 60 l) // set job config - job retries => 2 retries in 15 mins (optional) .setTargetName(“target_function”) // set target function’s name (optional) (either TargetName or TargetId is mandatory) // .setTargetId(1234567890L) // set the target function’s Id (optional) (either TargetName or TargetId is mandatory) .setParams(new JSONObject() { { put(“arg1”, “job”); put(“arg2”, “test”); } }) // set params to be passed to target function (optional) .setJobName(“job_name”) // set job name .setJobpoolName(“test”) // set the name of the Function jobpool to which the job should be submitted .build(); // build job meta
// submit function job ZCJobDetails functionJob = jobScheduling.job.submitJob(jobMeta);
Ensure the following packages are imported:
copy
import com.zc.component.jobscheduling.beans.job.ZCJobMetaDetail; import com.zc.component.jobscheduling.beans.job.ZCJobBuilder; import com.zc.component.jobscheduling.beans.job.ZCJobDetails; import org.json.simple.JSONObject;
copy
// generate circuit job meta ZCJobMetaDetail jobMeta = ZCJobBuilder.circuitJobBuilder() // create circuit job builder .setJobConfig(2, 15 * 60 l) // set job config - job retries => 2 retries in 15 mins (optional) .setTargetName(“target_circuit”) // set target circuits’s name (optional) (either TargetName or TargetId is mandatory) // .setTargetId(1234567890L) // set the target circuits’s Id (optional) (either TargetName or TargetId is mandatory) .setCircuitInput(new JSONObject() { { put(“key1”, “value1”); put(“key2”, “value2”); } }) // set the test cases for the circuit .setJobName(“test_job”) // set job name .setJobpoolName(“test”) // set the name of the Circuit jobpool where the job should be submitted .build(); // build circuit job meta
// submit circuit job ZCJobDetails circuitJob = jobScheduling.job.submitJob(jobMeta);
Ensure the following packages are imported:
copy
import com.zc.component.jobscheduling.beans.job.ZCJobMetaDetail; import com.zc.component.jobscheduling.beans.job.ZCJobBuilder; import com.zc.component.jobscheduling.beans.job.ZCJobDetails; import org.json.simple.JSONObject;
copy
// generate webhook job meta ZCJobMetaDetail jobMeta = ZCJobBuilder.webhookJobBuilder() // create web hook job builder .setJobConfig(2, 15 * 60 l) // set job config - job retries => 2 retries in 15 mins (optional) .setRequestMethod(“POST”) // set web hook request’s method .setUrl(“https://catalyst.zoho.com”) // set web hook request’s url .setParams(new JSONObject() { { put(“arg1”, “test”); put(“arg2”, “job”); } }) // set the web hook request’s query params (optional) .setHeaders(new JSONObject() { { put(“IS_TEST_REQUEST”, “true”); } }) // set the web hook request’s headers (optional) .setRequestBody(“test_request”) // set the web hook request’s body (optional) .setJobName(“test_job”) // set job name .setJobpoolName(“test”) // set the name of the Webhook jobpool to which the job should be submitted .build(); // build web hook job meta
// submit web hook job ZCJobDetails webHookJob = jobScheduling.job.submitJob(jobMeta);
Ensure the following packages are imported:
copy
import com.zc.component.jobscheduling.beans.job.ZCJobMetaDetail; import com.zc.component.jobscheduling.beans.job.ZCJobBuilder; import com.zc.component.jobscheduling.beans.job.ZCJobDetails; import org.json.simple.JSONObject;
copy
// generate appsail job meta ZCJobMetaDetail jobMeta = ZCJobBuilder.appSailJobBuilder() // create appsail job builder .setJobConfig(2, 15 * 60 l) // set job config - job retries => 2 retries in 15 mins (optional) .setTargetName(“test_appsail”) // set appsail name .setRequestMethod(“POST”) // set appsail request method .setUrl("/test") // set appsail request url .setParams(new JSONObject() { { put(“arg1”, “value1”); put(“arg2”, “value2”); } }) // set appsail request query params .setHeaders(new JSONObject() { { put(“IS_TEST_REQUEST”, “true”); } }) // set the appsail request’s headers (optional) .setRequestBody(“test_request”) // set the appsail request’s body (optional) .setJobName(“test_job”) // set job name .setJobpoolName(“test”) // set the name of the AppSail jobpool to which the job should be submitted .build(); // build appsail job meta
// submit appsail job ZCJobDetails appSailJob = jobScheduling.job.submitJob(jobMeta);
Last Updated 2025-06-20 16:21:48 +0530 +0530
Yes
No
Send your feedback to us