GLUE script tasks

Updated at:
Copy as MD

GLUE (Online Script) is an online script task pattern in XXL-JOB. This pattern lets you write and publish scripts in multiple languages directly in the MSE XXL-JOB console. You can use these scripts to dynamically update the business logic of scheduled tasks without redeploying your application.

Comparison between GLUE tasks and BEAN tasks

Dimension

GLUE script task

BEAN task

Execution method

Executes the script by forking a child process. Each execution creates a separate process, which results in some system overhead.

Executes within a thread. The task runs as a JobHandler in the thread pool of the executor's JVM. Resources are shared, and the overhead is low.

Resource overhead

High. When a task runs, the executor forks a child process to run the script. This consumes more resources than a BEAN task.

Low. Shares the JVM resources of the executor application.

Update method

Online updates that take effect immediately. Changes take effect after you edit and save the script in the console. No deployment is required.

Code changes require redeployment. You must modify the Java code, then package and publish a new version of the executor application.

Developer efficiency

High. Suitable for scenarios that require rapid iteration and validation.

Low. Follows standard software development and publishing processes.

Recommended scenarios

Scenarios with infrequent task scheduling, such as data cleaning, report generation, and API integration.

Core business logic, high-frequency scheduled tasks, and complex computations.

Scope

  • Engine version: MSE XXL-JOB Edition v2.2.2 or later.

  • Supported scripting languages: Java, Shell, Python, PHP, NodeJs, and PowerShell.

Create a GLUE script task

Procedure

  1. Log on to the MSE XXL-JOB console and select a Region from the top menu bar.

  2. On the Task Scheduling > XXL-JOB Version page, click the target instance.

  3. In the navigation pane on the left, choose Task Management, and then click Create Task.

  4. On the Create Task page, select an associated application and complete the task configuration.

    Note
    • Job Type: Select the GLUE task type that corresponds to your scripting language.

    • Script Content: The script code that the task executes.

  5. Click Complete.

Manage GLUE script tasks

Update a script

  1. In the Task Management list, find the Job that you want to modify.

  2. In the Running Mode column, click Edit Script.

  3. In the Edit Script window, modify the script content, and click OK.

  4. In the Latest Version window, enter the version name, and click OK.

Compare historical versions

  1. In the Task Management list, find the Job that you want to modify.

  2. In the Running Mode column, click Edit Script.

  3. In the Edit Script window, enable Version Comparison.

  4. Select a version name to view the historical version and its changes.