--- title: "Job Functions" url: https://docs.catalyst.zoho.com/en/serverless/help/functions/job-functions/ description: "Catalyst Functions are cloud-based, custom-built, serverless coding structures that contain the intense business logic of your application" last_updated: 2026-08-17T12:16:04Z service: Serverless type: general related_links: - name: "Job Pool Documentation" url: /en/job-scheduling/help/jobpool/introduction/ - name: "Create Job Pool" url: /en/job-scheduling/help/implementation/create-jobpool/ - name: "Submit Job to Function Job Pool" url: /en/job-scheduling/help/implementation/submit-instant-job/ - name: "Avoid Dispatch Delays When Executing Jobs" url: /en/job-scheduling/help/jobpool/key-concepts/#ideal-memory-allocation-to-avoid-dispatch-delay - name: "Java SDK" url: /en/sdk/java/v1/job-scheduling/overview/ - name: "Node.js SDK" url: /en/sdk/nodejs/v2/job-scheduling/overview/ - name: "Python SDK" url: /en/sdk/python/v1/job-scheduling/overview/ - name: "Job Scheduling REST APIs" url: /en/api/code-reference/job-scheduling/jobpool/get-all-jobpool/#GetAllJobPools --- # Job Functions ### Introduction Job Functions are a function type that you can invoke when a [job](https://docs.catalyst.zoho.com/en/job-scheduling/help/job/introduction/) is executed in a [Function Job Pool](https://docs.catalyst.zoho.com/en/job-scheduling/help/implementation/submit-instant-job/). You will code your custom business logic in this function, and it will be invoked at a scheduled time when a job to trigger the function is executed in the [job pool](https://docs.catalyst.zoho.com/en/job-scheduling/help/jobpool/introduction/). A Job Function is a non-HTTPS function, like [Event Functions](https://docs.catalyst.zoho.com/en/serverless/help/functions/event-functions/). This function will not have an endpoint, and the function will only be invoked when a job is executed in the function job pool with this particular job function as its target type. You can code your Job Function in the following runtimes: * [Java](https://docs.catalyst.zoho.com/en/sdk/java/v1/job-scheduling/overview/) - `v7`, `v11`, and `v17` * [Node.js](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/job-scheduling/overview/) - `v18` * [Python](https://docs.catalyst.zoho.com/en/sdk/python/v1/job-scheduling/overview/) - `v3.10`, `v3.11`, `v3.12`, `v3.13` Like the other *Serverless Functions*, you can create, initialize, and deploy Job Functions functions from the CLI. You can also upload your Job Function as a zip file to the console. However, since Job Functions are non-HTTPS functions, its URL is not accessible like [Basic I/O](https://docs.catalyst.zoho.com/en/serverless/help/functions/basic-io/) or [Advanced I/O functions](https://docs.catalyst.zoho.com/en/serverless/help/functions/advanced-io/). To test a Job Function, you can use the following CLI command and use the [function shell](https://docs.catalyst.zoho.com/en/cli/v1/working-with-functions/functions-shell/). ```sh catalyst functions:shell ``` A Job Function does not return any response other than determining if the function execution was a **success** or **failure**. You can also view and monitor the performance of the Job Function using the following [Catalyst DevOps](https://docs.catalyst.zoho.com/en/devops/) components: * [Logs](https://docs.catalyst.zoho.com/en/devops/help/logs/introduction/): You can view, manage, and monitor all executions pertaining to Job Functions. * [Application Performance Monitoring](https://docs.catalyst.zoho.com/en/devops/help/apm/introduction/): You can use this component to gather in-depth insights on Job Function’s performance. > **Note:** To execute a *Job Function* successfully, without any dispatch delays, always ensure that the **allocated memory of the job function** is **less than** that of the **allocated memory of the job pool**. You can find out more about preventing dispatch delays from this [help section](https://docs.catalyst.zoho.com/en/job-scheduling/help/jobpool/key-concepts/#ideal-memory-allocation-to-avoid-dispatch-delay). ### Benefits * A Job Function can be created, initialized, and deployed using Catalyst's robust CLI. This ensures that all dependencies that are required to deploy the function will be automatically installed when you [initialize the function through CLI](https://docs.catalyst.zoho.com/en/cli/v1/initialize-resources/initialize-functions/). * Job functions can also be created in Catalyst's Serverless Console via the [Editor](https://docs.catalyst.zoho.com/en/serverless/help/functions/implementation/#create-a-function). * Job functions will contain the ideal boilerplate code using which you can code any custom business logic, and the rest of the backend requirements will be handled by Catalyst. ### Function Boilerplate Code The boilerplate code present in the Job Function when you create it in the console or initialize it using the CLI is shown below: **Java** **Java Job Function Boilerplate** ```java import java.util.logging.Level; import java.util.logging.Logger; import com.catalyst.Context; import com.catalyst.job.JOB_STATUS; import com.catalyst.job.JobRequest; import com.catalyst.job.CatalystJobHandler; import com.zc.common.ZCProject; import com.zc.component.cache.ZCCache; public class Sample implements CatalystJobHandler { private static final Logger LOGGER = Logger.getLogger(Sample.class.getName()); @Override public JOB_STATUS handleJobExecute(JobRequest request, Context arg1) throws Exception { try { ZCProject.initProject(); Object eventData = request.getAllJobParams(); if (eventData != null) { LOGGER.log(Level.SEVERE, "Data is" + eventData.toString()); } LOGGER.log(Level.SEVERE, "Project Details " + request.getProjectDetails().toString()); ZCCache.getInstance().putCacheValue("JobSample", "Working", 1 l); LOGGER.log(Level.SEVERE, "Inserted SucessFully:)"); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception in Job Function", e); return JOB_STATUS.FAILURE; } return JOB_STATUS.SUCCESS; } } ``` **Node.js** **Node.js Job Function Boilerplate** ```javascript /** * * @param {import("./types/job").JobRequest} jobRequest * @param {import("./types/job").Context} context */ module.exports = (jobRequest, context) => { console.log('Hello from index.js'); // function input: { job_details: { job_meta_details: { params: { key: 'value' } } } } /** * JOB REQUEST FUNCTIONALITIES */ const projectDetails = jobRequest.getProjectDetails(); // to get the current project details const jobDetails = jobRequest.getJobDetails(); // to get the current job details const jobMetaDetails = jobRequest.getJobMetaDetails(); // to get the current job's meta details const jobpoolDetails = jobRequest.getJobpoolDetails(); // to get the current function job pool's details const getJobCapacityAttributes = jobRequest.getJobCapacityAttributes(); // to get the current jobs capacity const allJobParams = jobRequest.getAllJobParams(); // to get all the parameters supplied to the job function const jobParam = jobRequest.getJobParam('key'); // to get the value of a particular parameter supplied to the job function /** * CONTEXT FUNCTIONALITIES */ context.closeWithSuccess(); //end of application with success // context.closeWithFailure(); //end of application with failure }; ``` **Python** **Python Job Function Boilerplate** ```python import logging def handler(job_request, context): logger = logging.getLogger() logger.info('Hello from main.py') # function input: { job_details: { job_meta_details: { params: { key: 'value' } } } } '''JobRequest Functionalities''' job_details = job_request.get_job_details() # get the details of the current job project_details = job_request.get_project_details() # get the details of the current project job_meta_details = job_request.get_job_meta_details() # get the job meta of the current job job_pool_details = job_request.get_job_pool_details() # get the current functions job pool details job_capacity_attributes = job_request.get_job_capacity_attributes() # get the current jobs capacity all_job_params = job_request.get_all_job_params() # get all the parameters supplied to the job function job_param = job_request.get_job_param('key') # get the value of a particular parameter supplied to the job function '''Context Functionalities''' remaining_execution_time_ms = context.get_remaining_execution_time_ms() # get the maximum allowed execution time for the job functions max_execution_time_ms = context.get_max_execution_time_ms() # get the remaining execution time for this job function # context.close_with_failure() # conclude the function execution with a failure response context.close_with_success() # conclude the function execution with a success response ``` ### Testing Job Functions Using Catalyst CLI Job Functions are non-HTTPS functions like [Event](https://docs.catalyst.zoho.com/en/serverless/help/functions/event-functions/) and [Integrations](https://docs.catalyst.zoho.com/en/serverless/help/functions/integration-functions/) Functions. You cannot invoke a Job function manually, or test it in the console. However, you can generate sample payloads and test the function using the [Function Shell](https://docs.catalyst.zoho.com/en/cli/v1/working-with-functions/functions-shell/#functions-shell-command-execution) present in the [Catalyst CLI](https://docs.catalyst.zoho.com/en/cli/v1/cli-command-reference/). The following CLI command will generate a sample payload, and you can use it to test the function in the local environment. ```sh catalyst event:generate:job 10108000007982015 // Replace with the required Job Pool ID ``` ![catalyst_job_scheduling_job_functions_sample_payload](https://catalyst-docs-development.zohostratus.in/images/help/job-scheduling/catalyst_job_scheduling_job_functions_sample_payload.webp) You can feed this payload while you execute the required Job Function and validate the output. ### Job Function Arguments **Java** A Catalyst Job Function supports two arguments in **Java**: `JobRequest` and `Context`. The `JobRequest` argument contains the following built-in methods: * `JobRequest.getProjectDetails()`: Used to get the project details, such as the project ID and project name. * `JobRequest.getJobDetails()`: Used to get all the details of the Job including [Job ID](https://docs.catalyst.zoho.com/en/job-scheduling/help/job/key-concepts/#job-id), the Job Pool it is associated with, and Job Name. * `JobRequest.getJobMetaDetails()`: Used to get all the meta details of the Job including details on Execution Time, Dispatch Delay, and details on retry attempts. * `JobRequest.getJobpoolDetails()`: Used to get all the details of the Job Pool. The details include [Job Pool ID](https://docs.catalyst.zoho.com/en/job-scheduling/help/jobpool/key-concepts/#job-pool-id), Job Pool Name, and Job Pool Type. * `JobRequest.getJobCapacityAttributes()`: Used to get all the details about the memory allocated for the Function Job Pool. * `JobRequest.getAllJobParams()`: Used to get all the parameters (key-value pair) passed to the function. * `JobRequest.getJobParam(String key)`: Used to get all value of the params by passing the key as string to the function. The `Context` argument contains the following built-in methods: * `Context.getRemainingExecutionTimeMs()`: This can be used to fetch the remaining execution time of a job function. * `Context.getMaxExecutionTimeMs()`: This method can be used to get the maximum execution time of a job function, which is a constant value of **15 minutes**. **Node.js** A Catalyst Job Function supports two arguments in **Node.js**: `jobDetails` and `context`. The `jobDetails` argument contains the following built-in methods: * `jobDetails.getJobDetails()`: Used to get all the details of the Job including Job ID, the Job Pool it is associated with, and Job Name. * `jobDetails.getJobMetaDetails()`: Used to get all the meta details of the Job including details on Execution Time, Dispatch Delay, and details on retry attempts. * `jobDetails.getJobPoolDetails()`: Used to get all the details of the Job Pool. The details include Job Pool ID, Job Pool Name, and Job Pool Type. * `jobDetails.getProjectDetails()`: Used to get the project details, such as the project ID and project name. * `jobDetails.getJobCapacityAttributes()`: Used to get all the details about the memory allocated for the Function Job Pool. * `jobDetails.getAllJobParams()`: Used to get all the parameters (key-value pair) passed to the function. * `jobDetails.getJobParam(key)`: Used to get all value of the params by passing the key as string to the function. The `context` argument contains the following built-in methods: * `context.getRemainingExecutionTimeMs()`: This can be used to fetch the remaining execution time of a job function. * `context.getMaxExecutionTimeMs()`: This method can be used to get the maximum execution time of a job function, which is a constant value of 15 minutes. * `context.closeWithSuccess()`: This method can be used to mark a job's execution as successful. * `context.closeWithFailure()`: This method can be used to mark a job's execution as failure. **Python** A Catalyst Job Function supports two arguments in **Python**: `job_details` and `context`. The `job_details` argument contains the following built-in methods: * `job_details.get_job_details()`: Used to get all the details of the Job including Job ID, the Job Pool it is associated with, and Job Name. * `job_details.get_job_meta_details()`: Used to get all the meta details of the Job including details on Execution Time, Dispatch Delay, and details on retry attempts. * `job_details.get_job_pool_details()`: Used to get all the details of the Job Pool. The details include Job Pool ID, Job Pool Name, and Job Pool Type. * `job_details.get_project_details()`: Used to get the project details, such as the project ID and project name. * `job_details.get_job_capacity_attributes()`: Used to get all the details about the memory allocated for the Function Job Pool. * `job_details.get_all_job_params()`: Used to get all the parameters (key-value pair) passed to the function. * `job_details.get_job_param(key)`: Used to get all value of the params by passing the key as string to the function. The `context` argument contains the following built-in methods: * `context.get_remaining_execution_time_ms()`: This can be used to fetch the remaining execution time of a job function. * `context.get_max_execution_time_ms()`: This method can be used to get the maximum execution time of a job function, which is a constant value of 15 minutes. * `context.close_with_success()`: This method can be used to mark a job's execution as successful. * `context.close_with_failure()`: This method can be used to mark a job's execution as failure.