### HTTP Task Handler Example Source: https://www.xuxueli.com/xxl-job Example parameters for the generic HTTP task handler. ```text 1. url: http://www.xxx.com 2. method: get 或 post 3. data: post-data ``` -------------------------------- ### Executor Project Deployment Samples Source: https://www.xuxueli.com/xxl-job Examples of executor project types and their deployment methods. ```text xxl-job-executor-sample-springboot:项目编译打包成springboot类型的可执行JAR包,命令启动即可; xxl-job-executor-sample-frameless:项目编译打包成JAR包,命令启动即可; ``` -------------------------------- ### HTTP Task Full Parameter Example Source: https://www.xuxueli.com/xxl-job This is a comprehensive example demonstrating the parameters that can be set for a generic HTTP task handler. ```json { "url": "http://www.baidu.com", "method": "POST", "contentType": "application/json", "headers": { "header01": "value01" }, "cookies": { "cookie01": "value01" }, "timeout": 3000, "data": "request body data", "form": { "key01": "value01" }, "auth": "auth data" } ``` -------------------------------- ### Method Task Support Example Source: https://www.xuxueli.com/xxl-job Example of how to define a method-based task using the @XxlJob annotation. ```java 1. @XxlJob("demoJobHandler") 2. public ReturnT execute(String param) { 3. XxlJobLogger.log("hello world"); 4. return ReturnT.ofSuccess(); 5. } ``` -------------------------------- ### Docker Compose Startup Steps Source: https://www.xuxueli.com/xxl-job Steps to clone, build, configure, and start the XXL-JOB using Docker Compose. ```bash // Download XXL-JOB git clone --branch "$(curl -s https://api.github.com/repos/xuxueli/xxl-job/releases/latest | jq -r .tag_name)" https://github.com/xuxueli/xxl-job.git // Build XXL-JOB mvn clean package -Dmaven.test.skip=true // Configure XXL-JOB (go to docker directory, customize .env) cd ./docker cat .env // Start XXL-JOB docker compose up -d // Stop XXL-JOB docker compose down ``` -------------------------------- ### AI Executor Configuration Example Source: https://www.xuxueli.com/xxl-job Example configuration properties for the AI Executor, including Ollama and Dify settings. ```properties 1. // ollama 配置 2. spring.ai.ollama.base-url=http://localhost:11434 3. spring.ai.ollama.chat.enabled=true 4. // Model模型配置;注意,此处配置模型版本、必须本地先通过ollama进行安装运行。 5. spring.ai.ollama.chat.options.model=qwen2.5:1.5b 6. spring.ai.ollama.chat.options.temperature=0.8 7. 8. // dify 配置;选择相关 workflow 应用,切换 “访问API” 页面获取 url 地址信息. 9. dify.base-url=http://localhost/v1 10. // dify api-key;选择相关 workflow 应用并进入 “访问API” 页面,右上角 “API 密钥” 入口获取 api-key。 11. dify.api-key={自行获取并修改} ``` -------------------------------- ### Start and Stop XXL-JOB with Docker Compose Source: https://www.xuxueli.com/xxl-job Commands to start and stop XXL-JOB using Docker Compose. ```bash // 启动 docker compose up -d // 停止 docker compose down ``` -------------------------------- ### XxlJobHelper Usage Example Source: https://www.xuxueli.com/xxl-job Example of using XxlJobHelper to get job parameters and set task results. ```java 1. @XxlJob("demoJobHandler") 2. public void execute() { 3. String param = XxlJobHelper.getJobParam(); // 获取参数 4. XxlJobHelper.handleSuccess(); // 设置任务结果 5. } ``` -------------------------------- ### OpenClaw Job Handler Task Parameters Source: https://www.xuxueli.com/xxl-job Example task parameters for the OpenClaw Job Handler, supporting custom prompt and input. ```json 1. { 2. "input": "{输入信息,必填信息}", 3. "prompt": "{模型prompt,可选信息}" 4. } ``` -------------------------------- ### HTTP Job Handler Task Parameters Source: https://www.xuxueli.com/xxl-job Examples of task parameters for the generic HTTP Job Handler, demonstrating simple and complete configurations. ```json 1. // 1、简单示例: 2. { 3. "url": "http://www.baidu.com", 4. "method": "GET", 5. "data": "hello world" 6. } 7. 8. // 2、完整参数示例: 9. { 10. "url": "http://www.baidu.com", // 请求URL 11. "method": "POST", // 请求方法,支持:GET、POST、HEAD、OPTIONS、PUT、DELETE、TRACE 12. "contentType": "application/json", // 请求内容类型,支持:application/json、application/x-www-form-urlencoded、application/xml、text/html、text/xml、text/plain 13. "headers": { // 请求Header,key-value结构 14. "header01": "value01" 15. }, 16. "cookies": { // 请求Cookie,key-value结构 17. "cookie01": "value01" 18. }, 19. "timeout": 3000, // 请求超时时间,默认 3000;单位:毫秒; 20. "data": "request body data", // 请求Body数据,仅针对 POST 请求有效 21. "form": { // 请求Form数据,仅针对 GET 请求有效 22. "key01": "value01" 23. }, 24. "auth": "auth data" // 请求认证信息, 通过Basic Auth方式认证 25. } ``` -------------------------------- ### AI Executor Sample Initialization SQL Source: https://www.xuxueli.com/xxl-job SQL script to insert a new group for the AI executor sample into the xxl_job_group table. ```sql 1. INSERT INTO `xxl_job_group`(`app_name`, `title`, `address_type`, `address_list`, `update_time`) VALUES ('xxl-job-executor-sample-ai', 'AI执行器Sample', 0, NULL, now()); ``` -------------------------------- ### Docker Image Build and Run Commands Source: https://www.xuxueli.com/xxl-job Commands to build the XXL-JOB scheduler center Docker image and run it, including configuration options. ```Shell 1. /** 2. * build package 3. */ 4. mvn clean package 5. 6. /** 7. * build docker image 8. */ 9. docker build -t xuxueli/xxl-job-admin:{指定版本} ./xxl-job-admin 10. 11. /** 12. * 如需自定义 “项目配置文件” 中配置项,比如 mysql 配置,可通过 "-e PARAMS" 指定,参数格式: -e PARAMS="--key=value --key2=value2"; 13. * (配置项参考文件:/xxl-job/xxl-job-admin/src/main/resources/application.properties) 14. * 如需自定义 “JVM内存参数”,可通过 "-e JAVA_OPTS" 指定,参数格式: -e JAVA_OPTS="-Xmx512m" 15. * 如需自定义 “日志文件目录”,可通过 "-e LOG_HOME" 指定,参数格式: -e LOG_HOME=/data/applogs 16. */ 17. docker run -d \ 18. -e PARAMS="--spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai" \ 19. -p 8080:8080 \ 20. -v /tmp:/data/applogs \ 21. --name xxl-job-admin \ 22. xuxueli/xxl-job-admin:{指定版本} ``` -------------------------------- ### BEAN模式(类形式) - 步骤一:执行器项目中,开发Job类 Source: https://www.xuxueli.com/xxl-job Example of registering a JobHandler class in the executor project for BEAN mode (class form). ```java XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler()); ``` -------------------------------- ### Task Registration and Auto-Discovery Source: https://www.xuxueli.com/xxl-job Details about task registration and auto-discovery mechanism. ```Markdown 1. AppName: 每个执行器机器集群的唯一标示, 任务注册以 "执行器" 为最小粒度进行注册; 每个任务通过其绑定的执行器可感知对应的执行器机器列表; 2. 注册表: 见"xxl_job_registry"表, "执行器" 在进行任务注册时将会周期性维护一条注册记录,即机器地址和AppName的绑定关系; "调度中心" 从而可以动态感知每个AppName在线的机器列表; 3. 执行器注册: 任务注册Beat周期默认30s; 执行器以一倍Beat进行执行器注册, 调度中心以一倍Beat进行动态任务发现; 注册信息的失效时间为三倍Beat; 4. 执行器注册摘除:执行器销毁时,将会主动上报调度中心并摘除对应的执行器机器信息,提高心跳注册的实时性; ``` -------------------------------- ### BEAN模式(方法形式) - 步骤一:执行器项目中,开发Job方法 Source: https://www.xuxueli.com/xxl-job Example of developing a Job method with the "@XxlJob" annotation in the executor project for BEAN mode (method form). ```java // 可参考Sample示例执行器中的 "com.xxl.job.executor.jobhandler.SampleXxlJob" ,如下: @XxlJob("demoJobHandler") public void demoJobHandler() throws Exception { XxlJobHelper.log("XXL-JOB, Hello World."); } ``` -------------------------------- ### SQL Script Location for Scheduling Database Source: https://www.xuxueli.com/xxl-job This snippet indicates the location of the SQL script needed to initialize the scheduling database. ```text 1. /xxl-job/doc/db/tables_xxl_job.sql ``` -------------------------------- ### OllamaChat Job Handler Task Parameters Source: https://www.xuxueli.com/xxl-job Example task parameters for the OllamaChat Job Handler, supporting custom prompt, input, and model selection. ```json 1. { 2. "input": "{输入信息,必填信息}", 3. "prompt": "{模型prompt,可选信息}", 4. "model": "{模型实现,如qwen3.5:2b,可选信息}" 5. } ``` -------------------------------- ### Supported Script Task Types Source: https://www.xuxueli.com/xxl-job List of script types supported by GLUE mode. ```Markdown 1. - shell脚本:任务运行模式选择为 "GLUE模式(Shell)"时支持 "Shell" 脚本任务; 2. - python脚本:任务运行模式选择为 "GLUE模式(Python)"时支持 "Python" 脚本任务; 3. - php脚本:任务运行模式选择为 "GLUE模式(PHP)"时支持 "PHP" 脚本任务; 4. - nodejs脚本:任务运行模式选择为 "GLUE模式(NodeJS)"时支持 "NodeJS" 脚本任务; 5. - powershell:任务运行模式选择为 "GLUE模式(PowerShell)"时支持 "PowerShell" 脚本任务; ``` -------------------------------- ### Dify Workflow Job Handler Task Parameters Source: https://www.xuxueli.com/xxl-job Example task parameters for the DifyWorkflow Job Handler, supporting custom inputs, user, baseUrl, and apiKey. ```json 1. { 2. "inputs":{ 3. "input":"{用户输入信息}" // 该参数为示例变量,需要 workflow 的“开始”节点 自定义参数 “input”,可自行调整或删除。 4. }, 5. "user": "xxl-job", // 用户标识,选填 6. "baseUrl": "http://localhost/v1", // Dify应用的 访问API 地址,需要从 Dify 系统获取; 7. "apiKey": "xxx" // Dify应用的 API-Key,需要从 Dify 系统获取; 8. } ``` -------------------------------- ### Java Language Sharding Parameters Source: https://www.xuxueli.com/xxl-job How to obtain sharding parameters in Java for BEAN and GLUE modes. ```Java 1. // 可参考Sample示例执行器中的示例任务"ShardingJobHandler"了解试用 2. int shardIndex = XxlJobHelper.getShardIndex(); 3. int shardTotal = XxlJobHelper.getShardTotal(); ```