Backend Development 11 min read

PowerJob: Introduction, Installation, and Task Configuration Guide

This article introduces the PowerJob Java distributed scheduling framework, explains its features and task types, provides step‑by‑step installation via JAR and Docker, demonstrates database setup, server and worker configuration, and details how to create and configure scheduled tasks with code examples.

Selected Java Interview Questions
Selected Java Interview Questions
Selected Java Interview Questions
PowerJob: Introduction, Installation, and Task Configuration Guide

0. Introduction

Previously we introduced the popular distributed scheduling framework XXL‑Job; with technology evolution, new frameworks have emerged, and today we examine the next‑generation scheduling framework PowerJob.

1. PowerJob Overview

PowerJob is an enterprise‑grade distributed task scheduling platform built with Java. Like XXL‑Job, it offers a web UI for task configuration and logging, is easy to use, and quickly gained popularity.

Compared with other scheduling frameworks, PowerJob features a lock‑free design and stronger performance support; detailed comparisons are available on the official website.

Official documentation: http://www.powerjob.tech/

Task Types

PowerJob supports more task types than traditional frameworks:

API: Triggered via client API; the server does not schedule automatically, suitable for one‑off or tightly coupled business scenarios.

CRON: Scheduled with cron expressions, supported by most frameworks.

Fixed Frequency: Executes every specified number of milliseconds.

Fixed Delay: Executes after a specified delay.

Workflow: Integrated with workflow engines; the server runs the task when the workflow reaches this node.

2. PowerJob Installation

PowerJob can be installed either by running the JAR package or via Docker. Docker installation is straightforward and documented on the official site, so we focus on the JAR method.

1. Download the source code from GitHub and compile or use a released JAR.

https://github.com/PowerJob/PowerJob

2. Open the project in an IDE and locate the powerjob-server module (the server) and the powerjob-worker-samples module (Spring Boot usage example).

3. Create a database for PowerJob, for example:

CREATE DATABASE IF NOT EXISTS `powerjob-daily` DEFAULT CHARSET utf8mb4

4. Modify application-daily.properties under powerjob-server/powerjob-server-starter to match your database settings.

5. Run the server main class PowerJobServerApplication . After a successful start, access http://localhost:7700 and you should see the login page.

6. Register an executor; the application name must match the app-name configured in the client.

7. Log in with the executor name and password.

8. After login, the dashboard appears.

9. To deploy to a server or VM, compile and package the project:

Run mvn install to install dependencies locally.

If Maven health checks fail, disable them as described.

Run mvn package to create the JAR.

In the powerjob-server-starter target directory, locate the JAR and start it with java -jar .

3. Creating a Scheduled Task

1. Create a Spring Boot project for the client and add the PowerJob worker starter dependency:

<dependency>
  <groupId>tech.powerjob</groupId>
  <artifactId>powerjob-worker-spring-boot-starter</artifactId>
  <version>4.3.2</version>
</dependency>

2. Configure the client in application.yml (or .properties ) with fields such as worker.enabled , app-name , server-address , protocol , and resource limits.

powerjob:
  worker:
    enabled: true
    enable-test-mode: false
    # Data transmission port, default 27777
    port: 27777
    # Application name, must match the server‑side executor name
    app-name: powerjob-agent-test
    # Server address, multiple addresses separated by commas
    server-address: 127.0.0.1:7700
    # Communication protocol, http or akka (http recommended)
    protocol: http
    max-result-length: 4096
    max-lightweight-task-num: 1024
    max-heavy-task-num: 64

3. Add @EnableScheduling to the Spring Boot main class.

4. Implement a job by declaring a class that implements BasicProcessor and annotating it with @Component :

/**
 * @author benjamin_5
 * @description Simple job processor
 */
@Component
public class SimpleJobServer implements BasicProcessor {

    @Override
    public ProcessResult process(TaskContext taskContext) throws Exception {
        String jobParams = taskContext.getJobParams();
        System.out.println("参数: " + jobParams);
        System.out.println("定时任务执行");
        return new ProcessResult(true, "定时任务执行成功");
    }
}

5. Start the client project; the server UI will show the new worker instance.

6. In the server UI, click “Create Task”, specify the processor class (e.g., com.example.powerjobdemo.job.SimpleJobServer ), and configure task details.

7. After creation, the task appears in the list and runs according to the defined schedule.

4. Task Configuration Parameters

When creating a task, the UI presents several configuration sections:

Timing Information

Select the task type (API, CRON, Fixed Frequency, Fixed Delay, Workflow, Daily Fixed Interval, etc.).

Lifecycle

Define the effective period of the task, useful for tasks that should run only within a specific time window.

Execution Configuration

Choose execution mode: single‑node, broadcast, Map, or MapReduce.

Single‑node: only one node executes the task.

Broadcast: all nodes execute the task (e.g., log cleanup).

Map: splits input data into chunks for parallel processing.

MapReduce: a full big‑data processing model with map and reduce phases.

Runtime Configuration

Set the node selection strategy ( HEALTH_FIRST or RANDOM ), maximum instance count, concurrency level, and execution time limits.

More details can be found in the official documentation: https://www.yuque.com/powerjob/guidence/ysug77
BackendJavadistributed schedulingtask schedulingPowerJob
Selected Java Interview Questions
Written by

Selected Java Interview Questions

A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.