$ show xuxueli/xxl-job
XXL-JOB is a distributed task scheduling framework designed for rapid development, simplicity, and lightweight operation. It consists of a scheduler center (admin) and multiple executors. The admin provides a web UI for CRUD job management, scheduling (cron, fix rate, fix delay), routing strategies (first, last, round, random, consistent hash, LFU, LRU, failover, busyover, sharding broadcast), misfire handling, alarm (email), and monitoring. Executors run on any JVM and communicate with the admin via Netty-based HTTP RPC. The framework supports BEAN (annotated methods), GLUE (online Groovy/script editing), script tasks (Shell, Python, PHP, NodeJS, PowerShell), HTTP tasks, and AI tasks (Ollama, Dify, OpenClaw). It includes an OpenAPI for cross-language integration, user management with role-based permissions, and Docker deployment. The architecture is modular: xxl-job-core provides the executor runtime and shared interfaces, xxl-job-admin is the Spring Boot admin application, and sample executors demonstrate integration. External dependencies include MySQL (persistence), Netty (executor server), Groovy (glue tasks), and Spring Boot. The framework is production-ready with HA support for both scheduler and executor clusters.
The LLM identified 4 files worth highlighting for reuse:
A standalone cron expression parser and evaluator (derived from Quartz) that can validate, compute next/previous trigger times, and handle special characters (L, W, #). It is fully self-contained and can be extracted into any Java project requiring cron scheduling logic.
An enum-based registry of executor routing strategies (first, last, round, random, consistent hash, LFU, LRU, failover, busyover). Each strategy is implemented as a separate class extending ExecutorRouter. The enum provides a clean, extensible way to select and invoke routing logic, demonstrating a reusable strategy pattern with enum registration.
An interface for job alarm implementations, with a default email alarm (EmailJobAlarm). The JobAlarmer collects all beans implementing this interface and invokes them on job failure. This plugin pattern allows easy addition of new alarm channels (SMS, DingTalk, etc.) without modifying core logic.
A utility class providing static methods for job handlers to access parameters, set results, log messages, and retrieve sharding information. It encapsulates InheritableThreadLocal-based context management and provides a clean API for job development. Reusable in any project using XXL-JOB executor.