Key Concepts

Before you learn about configuring a cron, it’s important to understand certain key concepts and terminology about Catalyst Cron.

Task Engine

The task engine handles the backend logic of cron and handles the execution of cron jobs as per their defined schedule time.

Schedule Point

The schedule point determines the entity to trigger when a cron job is executed. A cron can trigger either of the following:

  • Function: You can code a cron function to execute any one-time or recurring routine job that you require. You can pass parameter values to this target function dynamically when the function is called, if needed. You can also insert a placeholder in a parameter. A placeholder is a representational variable for the dynamic value that is passed. When the value is generated at the time of execution, it replaces the placeholder variable.

  • Third-party URL: When a cron’s execution invokes a third-party URL, it sends a HTTP request to the target URL that you specify. This allows for data transmission to occur between Catalyst and the specified target URL, where Catalyst can read data from the destination server or input your application’s data to the corresponding components in the server. The following components are involved in sending a request to the third-party URL:

    • HTTP request methods
      The following HTTP request methods are supported while invoking a third-party URL by a cron:

      • POST: Creates a new resource in the target URL
      • GET: Retrieves data from the target URL
      • PUT: Replaces an existing resource in the target URL
      • DELETE: Deletes an existing resource in the target URL
    • Headers
      When the HTTP request is sent to the target URL, the requesting entity sends default headers in the request to provide information about the request. Some examples of default headers include the origin of the request, the connection type, and the Content-Type.

      In addition to the default headers, you can also define custom headers in the HTTP request. For example, you can include a header that specifies the authorization type used, a list of acceptable encoding, or the origin date of the request.

      Note: If you use the HTTP POST or PUT methods in your request, you should set the content-type of the data that is sent in the header. The content-types that are supported are TEXT (text/plain), JSON (application/JSON), JavaScript (application/javascript), XML (application/xml), XML (text/xml), and HTML (text/html).

    • URL Parameters
      You can pass custom URL parameters in the User-Defined format with the HTTP request, whose values are set dynamically when the third-party URL is invoked. You can customize the parameter value and include any terms that you require to be passed in the parameter.

    • Request Body
      You can include an optional HTTP request body while invoking the URL, which can be used to carry form data and other optional data. You can pass the form data in the optional message body in various formats.

  • Circuits: You can create an automated workflow using the Circuits component, and configure a cron job to trigger it either once or recursively. You can create a Circuit and design its schema from the Serverless section in the console either through a simple drag-and-drop, or by coding the workflow in JSON. You can then associate the circuit with a cron while creating the cron. You will need to configure the input to be passed to the associated circuit in the form of a JSON. Similar to functions, you can also provide placeholder values in the JSON input. Circuits enable you to execute a bunch of tasks in parallel, or in a sequence, and pass data between them.

Schedule Type

The schedule type determines the frequency of a cron job’s execution. A cron can be executed in one of two ways:

  • One Time: The cron job is triggered only once on the configured date and time.
  • Recursive: The cron job is triggered multiple times recursively based on the frequency, date, and time you configure, until you disable or delete it. The minimum recurring frequency a cron can be triggered at is one hour.

Execution ID

Each cron job is assigned a unique Execution ID when the cron is invoked. You can use this ID to refer to the cron job in your application code or while viewing its execution logs.

Last Updated 2023-07-18 15:51:58 +0530 +0530