Distributed Java scheduling framework of the task scheduling framework XXL-Job Introduction and Quick Start
The scheduler uses scenarios:
Java developers often use the scheduled tasks: for example, the early morning of every month on the 1st generation of the bill last month, for example every day 1:00 on the day of data reconciliation operation, such as 5:00 each day to 180 days have not landed users to send e-mail reminders, and more. In our regular tasks development also plays an important part.
Java There are many ways to achieve timing tasks:
1.JDK timer comes to realize that java.util.TimerTask class
2. Use a timer to achieve Quartz
3. Use the spring-related tasks scheduling. Since spring 3.0+, spring comes the task of scheduling, mainly rely on more than a dozen TaskScheduler interface to implement to achieve
4.spring combination of quartz realized
5. With the linux achieved crontabe
So on the other.
A distributed task scheduling framework in which Li Kaige -XXL-Job introduction. Author: Xu snow. The code is now open source.
xxl-job introduction:
First look at the latest version v2.1.0 of architecture diagram:
Look at the stars on the git:
Then look at the development of xxl-job:
Let's take a look at the official description:
XXL-JOB is a distributed task scheduling platform, its core design goal is to develop rapid, simple to learn, lightweight, easy to expand. Open source and now online companies access to the product line, out of the box.
Getting Started
Source Downloads:
On the git source code download (due to platform limitations, Kaige not posted a git address), to use the git command: git clone.
After downloading the code into the idea.
Environmental requirements:
Maven 3+
jdk1.7 +
mysql5.7+
Let's look at the structure of the project:
Initialization sql script
In /xxl-job/doc/db/tables_xxl_job.sql is sql script file.
sql initialization error resolution
Sql script when importing, you may encounter the following error:
Refer to the following article can be modified:
After sql script execution, you can see the following table of six.
Configuration Tasks dispatch center
XXL-Job in all projects, mission control center is the source of xxl-job-admin this project. We need to change the information in the project to become their own.
Modify the configuration file admin
File Address: /xxl-job/xxl-job-admin/src/main/resources/xxl-job-admin.properties
1: Modify the database information
2: If you need e-mail, then you can configure into their own. Other items can be modified according to the needs
Deployment control center project
Because the project is spring boot admin project, so we directly run: XxlJobAdminApplication can be. File location below:
After starting the project, in the browser enter: 127.0.0.1: 8080 / xxl-job-admin
The default user name and password -> User name: admin Password: 123456
After landing, the interface appears as shown below:
Menu description:
Run the report: the above chart. A scheduler operation report
Task Management: Timing task management list
Schedule log: Run Logging
Actuator Management:
Configure to perform, and then in the Task Manager, a new task manager, after starting the task, you can schedule log in to view the results of the operation.
In the next article, we will describe how the integration project in spring boot xxl-job tutorial. Welcome to learn together.
This article Source: Kaige Java (kaigejava)