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.
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.zip2.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.sql2.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.shCheck 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
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Selected Java Interview Questions
A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
