AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Xxl Job Xugudb Adapter

skill-kourou25-xugudb-dev-skills-xxl-job-xugudb-adapter · by kourou25

XXL-JOB 分布式任务调度框架与虚谷数据库(XuguDB)集成适配指南。当用户需要在 Spring Boot 项目中使用 XXL-JOB 连接 XuguDB 时使用此技能,包括任务调度配置、数据源设置、执行器配置、任务处理器编写、路由策略、分片任务等。适用于定时任务、批量数据处理、分布式计算、工作流编排等场景。

— No reviews yet
0 installs
32 views
0.0% view→install

Install

$ agentstack add skill-kourou25-xugudb-dev-skills-xxl-job-xugudb-adapter

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • ✓ Prompt-injection patterns
  • ✓ Secret / credential exfiltration
  • ✓ Dangerous shell & filesystem operations
  • ✓ Untrusted network calls
  • ✓ Known-malicious package signatures

What it can access

  • ✓ Network access No
  • ✓ Filesystem access No
  • ✓ Shell / process execution No
  • ✓ Environment & secrets No
  • ✓ Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-kourou25-xugudb-dev-skills-xxl-job-xugudb-adapter)

Reliability & compatibility

✓ Security review passed
0 installs to date
— no reviews yet
● 3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Xxl Job Xugudb Adapter? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

XXL-JOB 分布式任务调度 XuguDB 适配指南

概述

本指南详细介绍如何将 XXL-JOB 分布式任务调度框架与虚谷数据库(XuguDB)集成,包括完整的配置流程、使用示例和最佳实践。XXL-JOB 是一个轻量级分布式任务调度框架,支持动态任务管理、多种路由策略和故障转移。

快速开始

1. 获取适配版 XXL-JOB

由于官方 XXL-JOB 不支持 XuguDB,需要使用虚谷提供的适配版本:

# 下载适配版 XXL-JOB
# 访问:https://help.xugudb.com/content/ecosystem/orm/java/xxl-job

2. 初始化数据库

在 XuguDB 中创建数据库:

CREATE DATABASE `xxl_job` CHARACTER SET 'utf8_bin' TIME ZONE 'GMT+08:00';
USE xxl_job;
CREATE USER `xxl_job` IDENTIFIED BY 'xxl_job';
GRANT DBA IN SCHEMA `xxl_job' TO 'xxl_job';

执行适配版提供的 SQL 初始化脚本 tables_xxl_job_xugu.sql。

3. 配置数据源

在 application.properties 中配置:

spring.datasource.driver-class-name=com.xugudb.jdbc.Driver
spring.datasource.url=jdbc:xugu://127.0.0.1:5138/xxl_job
spring.datasource.username=xxl_job
spring.datasource.password=xxl_job
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=20

xxl.job.accessToken=default_token

4. 启动 XXL-JOB Admin

java -jar xxl-job-admin-2.3.1.jar --spring.config.location=file:./application.properties

5. 访问管理界面

  • 地址:http://localhost:8080/xxl-job-admin/toLogin
  • 默认账号:admin
  • 默认密码:123456

配置详解

数据源配置参数

| 参数 | 说明 | 推荐值 | |------|------|--------| | driver-class-name | XuguDB JDBC 驱动类 | com.xugudb.jdbc.Driver | | url | 数据库连接 URL | jdbc:xugu://host:port/db | | accessToken | 通信令牌 | default_token(建议修改) |

连接池配置

spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.max-lifetime=1800000

执行器集成

1. 添加 Maven 依赖


    
    
        com.xuxueli
        xxl-job-core
        2.3.1
    
    
    
    
        com.xugudb
        xugu-jdbc
        12.3.4
    

2. 配置执行器

在 application.yml 中配置:

xxl:
  job:
    admin:
      addresses: http://127.0.0.1:8080/xxl-job-admin
    executor:
      appname: my-executor
      port: 9999
      logpath: /data/applogs/xxl-job/jobhandler
      logretentiondays: 30
    accessToken: default_token

3. 配置执行器 Bean

@Configuration
public class XxlJobConfig {
    
    @Value("${xxl.job.admin.addresses}")
    private String adminAddresses;
    
    @Value("${xxl.job.accessToken}")
    private String accessToken;
    
    @Value("${xxl.job.executor.appname}")
    private String appname;
    
    @Value("${xxl.job.executor.port}")
    private int port;
    
    @Value("${xxl.job.executor.logpath}")
    private String logpath;
    
    @Value("${xxl.job.executor.logretentiondays}")
    private int logretentiondays;
    
    @Bean
    public XxlJobSpringExecutor xxlJobExecutor() {
        XxlJobSpringExecutor executor = new XxlJobSpringExecutor();
        executor.setAdminAddresses(adminAddresses);
        executor.setAppname(appname);
        executor.setPort(port);
        executor.setLogPath(logpath);
        executor.setLogRetentionDays(logretentiondays);
        executor.setAccessToken(accessToken);
        return executor;
    }
}

任务处理器

Bean 模式任务处理器

@Component
public class MyJobHandler {
    
    @XxlJob("myJobHandler")
    public void myJobHandler() throws Exception {
        String jobParam = XxlJobHelper.getJobParam();
        XxlJobHelper.log("执行任务,参数:" + jobParam);
        XxlJobHelper.handleSuccess("任务执行成功");
    }
}

分片任务处理器

@Component
public class ShardingJobHandler {
    
    @XxlJob("shardingJobHandler")
    public void shardingJobHandler() throws Exception {
        int shardIndex = XxlJobHelper.getShardIndex();
        int shardTotal = XxlJobHelper.getShardTotal();
        
        XxlJobHelper.log("分片参数:当前分片={}, 总分片={}", shardIndex, shardTotal);
        
        // 处理分片任务
        List items = getItemList();
        for (int i = 0; i 

最佳实践

  1. 使用清晰的任务描述
  2. 合理设置路由策略
  3. 避免任务执行时间过长
  4. 部署多个调度中心节点实现高可用
  5. 使用 Nginx 进行负载均衡
  6. 监控集群状态和任务执行情况
  7. 定期备份数据库

资源

  • 示例项目:https://github.com/xuxueli/xxl-job
  • 官方文档:https://help.xugudb.com/content/ecosystem/orm/java/xxl-job
  • XXL-JOB 官网:http://www.xuxueli.com/xxl-job/

注意:本指南基于 XXL-JOB v2.3.1 适配版本,确保使用正确的版本以避免兼容性问题。必须使用虚谷提供的适配版 XXL-JOB 和专用 SQL 初始化脚本。

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.