Deploying and Using delay-job for Distributed Delayed Task Scheduling

This article demonstrates how to set up the open‑source delay-job system, configure its database, start the server, and integrate a client via HTTP to register and trigger delayed tasks, providing a concise end‑to‑end backend scheduling solution.

Selected Java Interview Questions
Selected Java Interview Questions
Selected Java Interview Questions
Deploying and Using delay-job for Distributed Delayed Task Scheduling

1 Background

Orders that remain unpaid and user registrations that lack complete information need timely handling; delay-job is a lightweight distributed delayed task scheduler designed for these scenarios and is available as an open‑source project on GitHub.

2 Usage

2.1 Server Deployment

2.1.1 Download delay-job

# wget https://github.com/findthinks/delay-job/releases/download/0.6.1/delay-job-bin-0.6.1.zip
# unzip delay-job-bin-0.6.1.zip

2.1.2 Create Database Tables

Execute the SQL script located at docs/db/schema_init.sql to create the required tables.

mysql> source /root/delay-job/docs/db/schema_init.sql

2.1.3 Modify Configuration

Edit the configuration file /root/delay-job/config/application.yaml to match your database settings (the article uses the default configuration).

2.1.4 Start the Service

# cd /root/delay-job/bin
# ./startup.sh

Check log/delay-job.log to confirm the service started successfully and is listening on ports 1989 (HTTP) and 1990 (gRPC).

2.2 Client Integration

delay-job can send notifications via HTTP, gRPC, or Kafka; this guide uses HTTP. A simple Spring Boot HTTP endpoint is used to receive task callbacks, with both client and server running on the same machine for convenience.

2.2.1 Start the Client

The client’s HTTP callback endpoint is http://127.0.0.1:9000/recv/notify.

2.2.2 Register a Delayed Task

Manually submit a test job that will trigger at Unix timestamp 1678206771 and notify the above endpoint.

curl -X 'POST' 'http://localhost:1989/api/v1/submit/job' \
  -H 'Content-Type:application/json' \
  -d '{
      "outJobNo":"job_no_000000000004",
      "triggerTime":1678206771,
      "callbackProtocol":"HTTP",
      "callbackEndpoint":"http://127.0.0.1:9000/recv/notify",
      "jobInfo":"First delay job."
    }'

2.2.3 Trigger Notification

At the specified trigger time, the client receives the callback for job job_no_000000000004 on the configured HTTP endpoint.

3 Summary

The guide shows how to quickly implement delayed scheduling business logic by leveraging the open‑source delay-job project, with straightforward steps for server setup, configuration, and client integration.

References

https://github.com/findthinks/delay-job

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Distributed Schedulingmysqldelay-job
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

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.