Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to access php Project to xxl-job dispatching system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "php project how to access xxl-job scheduling system", in daily operation, I believe many people in php project how to access xxl-job scheduling system problems have doubts, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer "php project how to access xxl-job scheduling system" doubts helpful! Next, please follow the small series to learn together!

1. Deployment of xxl-job dispatch center

Here, please make your own hundred. The following highlights how to connect php projects to xxl-job scheduling.

2. integrate xxl-job scheduling system

The core is GLUE running mode using xxl-job, calling remote http resources through a php code fragment.

2.1 Create an actuator project

Refer to the executor sample project, xxl-job-executor-samples/xxl-job-executor-sample-springboot, modify the application.properties file below, and the content is as follows:

#Port number used by executor projectserver.port=8585# no web#spring.main.web-environment=false # log configlogging.config=classpath:logback.xml ###Dispatch center address xxl.job.admin.addresses= http://127.0.0.1:8081/job-admin ## xxl-job, access tokenxxl.job.accessToken= ## xxl-job executor appnamexxl.job.executor.appname=xxl-job-executor-base## xxl-job executor registry-address: default use address to registry , otherwise use ip: port if address is nullxxl.job.executor.address=### xxl-job executor server-infoxxl.job.executor.ip=127.0.0.1xxl.job.executor.port=9999### xxl-job executor log-pathxxl.job.executor.logpath=xxl-job-log### xxl-job executor log-retention-daysxxl.job.executor.logretentiondays= 302.2 New actuator

In the management interface of dispatching center, add an actuator, and the relevant information of the actuator must be consistent with the configuration in step [2.1], as follows:

Note: The machine address here must be accompanied by the protocol name in the new version, such as http.

2.3 Deployment of actuator projects

Copy the compiled xxl-job-executor-sample-springboot-2.2.1-SNAPSHOT.jar package to the machine where the php project is located, and start it. Start command is:

java -jar -Dfile.encoding=utf-8 "xxl-job-executor-sample-springboot-2.2.1-SNAPSHOT.jar"

2.4 New GLUE Mode Task

Select the actuator newly created in step [2.2], and select [GLUE(PHP)] for operation mode.

2.5 Write php code snippets

In the task list, find the previously created GLUE task, and then select the GLUE IDE menu in the corresponding operation bar to enter the built-in web editor of xxl-job, and then write the php code related to the business.

An example would read as follows:

Note:

① The script task judges the task execution result through Exit Code, 0 succeeds,-1 (non-zero status code) fails.

② During scheduling, a temporary php file will be generated under the gluresource directory (located under the root directory of the log), and the file content is the code fragment written in step [2.5].

At this point, the study of "how to access xxl-job scheduling system for php projects" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report