Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xxl-job
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘晓滨
xxl-job
Commits
11ff077a
Commit
11ff077a
authored
Nov 07, 2018
by
刘晓滨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跟新调整
parent
6a3781bf
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
200 additions
and
4 deletions
+200
-4
application.properties
xxl-job-admin/src/main/resources/application.properties
+4
-3
pom.xml
...ecutor-samples/xxl-job-executor-sample-springboot/pom.xml
+27
-1
XxlJobExecutorApplication.java
.../java/com/xxl/job/executor/XxlJobExecutorApplication.java
+1
-0
XxlJobConfig.java
...n/java/com/xxl/job/executor/core/config/XxlJobConfig.java
+4
-0
PushKcDateHandler.java
...xl/job/executor/service/jobhandler/PushKcDateHandler.java
+58
-0
spacetech-consumer-apihub.xml
...ringboot/src/main/resources/spacetech-consumer-apihub.xml
+106
-0
No files found.
xxl-job-admin/src/main/resources/application.properties
View file @
11ff077a
### web
### web
server.port
=
80
80
server.port
=
80
91
server.context-path
=
/xxl-job-admin
server.context-path
=
/xxl-job-admin
### resources
### resources
...
@@ -11,14 +11,15 @@ spring.freemarker.templateLoaderPath=classpath:/templates/
...
@@ -11,14 +11,15 @@ spring.freemarker.templateLoaderPath=classpath:/templates/
spring.freemarker.suffix
=
.ftl
spring.freemarker.suffix
=
.ftl
spring.freemarker.charset
=
UTF-8
spring.freemarker.charset
=
UTF-8
spring.freemarker.request-context-attribute
=
request
spring.freemarker.request-context-attribute
=
request
spring.freemarker.settings.number_format
=
0.##########
### mybatis
### mybatis
mybatis.mapper-locations
=
classpath:/mybatis-mapper/*Mapper.xml
mybatis.mapper-locations
=
classpath:/mybatis-mapper/*Mapper.xml
### xxl-job, datasource
### xxl-job, datasource
spring.datasource.url
=
jdbc:mysql://1
27.0.0.1:3306/xxl-job?
Unicode=true&characterEncoding=UTF-8
spring.datasource.url
=
jdbc:mysql://1
0.10.10.3:3306/xxl-job?use
Unicode=true&characterEncoding=UTF-8
spring.datasource.username
=
root
spring.datasource.username
=
root
spring.datasource.password
=
root_pwd
spring.datasource.password
=
Space1234
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.type
=
org.apache.tomcat.jdbc.pool.DataSource
spring.datasource.type
=
org.apache.tomcat.jdbc.pool.DataSource
...
...
xxl-job-executor-samples/xxl-job-executor-sample-springboot/pom.xml
View file @
11ff077a
...
@@ -55,7 +55,6 @@
...
@@ -55,7 +55,6 @@
<artifactId>
jetty-client
</artifactId>
<artifactId>
jetty-client
</artifactId>
<version>
${jetty-server.version}
</version>
<version>
${jetty-server.version}
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
@@ -78,6 +77,33 @@
...
@@ -78,6 +77,33 @@
<version>
${project.parent.version}
</version>
<version>
${project.parent.version}
</version>
</dependency>
</dependency>
<!-- dubbo -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo
</artifactId>
<version>
2.8.4
</version>
</dependency>
<!-- 公用的服务接口 -->
<dependency>
<groupId>
com.spacetech.gateway
</groupId>
<artifactId>
gateway
</artifactId>
<version>
2.98-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.javassist
</groupId>
<artifactId>
javassist
</artifactId>
<version>
3.18.1-GA
</version>
<!--$NO-MVN-MAN-VER$-->
</dependency>
<dependency>
<groupId>
com.101tec
</groupId>
<artifactId>
zkclient
</artifactId>
<version>
0.9
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/XxlJobExecutorApplication.java
View file @
11ff077a
...
@@ -2,6 +2,7 @@ package com.xxl.job.executor;
...
@@ -2,6 +2,7 @@ package com.xxl.job.executor;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
/**
/**
* @author xuxueli 2018-10-28 00:38:13
* @author xuxueli 2018-10-28 00:38:13
...
...
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
View file @
11ff077a
...
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.ImportResource
;
/**
/**
* xxl-job config
* xxl-job config
...
@@ -15,6 +16,7 @@ import org.springframework.context.annotation.Configuration;
...
@@ -15,6 +16,7 @@ import org.springframework.context.annotation.Configuration;
*/
*/
@Configuration
@Configuration
@ComponentScan
(
basePackages
=
"com.xxl.job.executor.service.jobhandler"
)
@ComponentScan
(
basePackages
=
"com.xxl.job.executor.service.jobhandler"
)
@ImportResource
(
locations
=
"classpath:spacetech-consumer-apihub.xml"
)
public
class
XxlJobConfig
{
public
class
XxlJobConfig
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
XxlJobConfig
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
XxlJobConfig
.
class
);
...
@@ -52,6 +54,8 @@ public class XxlJobConfig {
...
@@ -52,6 +54,8 @@ public class XxlJobConfig {
xxlJobSpringExecutor
.
setLogPath
(
logPath
);
xxlJobSpringExecutor
.
setLogPath
(
logPath
);
xxlJobSpringExecutor
.
setLogRetentionDays
(
logRetentionDays
);
xxlJobSpringExecutor
.
setLogRetentionDays
(
logRetentionDays
);
return
xxlJobSpringExecutor
;
return
xxlJobSpringExecutor
;
}
}
...
...
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/PushKcDateHandler.java
0 → 100644
View file @
11ff077a
package
com
.
xxl
.
job
.
executor
.
service
.
jobhandler
;
import
java.util.Date
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.alibaba.fastjson.JSONObject
;
import
com.spacetech.gateway.BaseDataApiHub
;
import
com.spacetech.gateway.SqxyApiHub
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.handler.IJobHandler
;
import
com.xxl.job.core.handler.annotation.JobHandler
;
import
com.xxl.job.core.log.XxlJobLogger
;
/**
* 任务Handler示例(Bean模式)
*
* 开发步骤:
* 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”;
* 2、注册到Spring容器:添加“@Component”注解,被Spring容器扫描为Bean实例;
* 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。
* 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
*
* @author xuxueli 2015-12-19 19:43:36
*/
@JobHandler
(
value
=
"pushKcDateHandler"
)
@Component
public
class
PushKcDateHandler
extends
IJobHandler
{
private
static
Long
SQXY_CAMPUSID
=
3418L
;
private
static
Integer
TYPE_TEACHER
=
1
;
private
static
Integer
TYPE_STUDENT
=
2
;
@Autowired
private
SqxyApiHub
sqxyApiHub
;
@Override
public
ReturnT
<
String
>
execute
(
String
param
)
throws
Exception
{
XxlJobLogger
.
log
(
"XXL-JOB, Hello World."
);
String
api
=
"sqxy_kcsj_push"
;
XxlJobLogger
.
log
(
" start - 课程开课提醒接口调用启动;time:"
+
new
Date
());
for
(
Integer
type
=
TYPE_TEACHER
;
type
<=
TYPE_STUDENT
;
type
++)
{
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"campusid"
,
SQXY_CAMPUSID
);
sqxyApiHub
.
callApi
(
api
.
split
(
"_"
)[
1
]
+
"_"
+
api
.
split
(
"_"
)[
2
],
false
,
params
);
}
XxlJobLogger
.
log
(
" end - 课程开课提醒接口调用结束;time:"
+
new
Date
());
return
SUCCESS
;
}
}
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/spacetech-consumer-apihub.xml
0 → 100644
View file @
11ff077a
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
>
<dubbo:application
name=
"spacetech-consumer-xxljob"
owner=
"programmer"
organization=
"dubbox"
/>
<dubbo:registry
address=
"zookeeper://10.10.10.190:2182"
/>
<dubbo:consumer
retries=
"0"
check=
"false"
timeout=
"60000"
/>
<dubbo:reference
id=
"appStoreApiHub"
interface=
"com.spacetech.gateway.AppStoreApiHub"
check=
"false"
/>
<dubbo:reference
id=
"electiveApiHub"
interface=
"com.spacetech.gateway.ElectiveApiHub"
check=
"false"
/>
<dubbo:reference
id=
"portalApiHub"
interface=
"com.spacetech.gateway.PortalApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"messageApiHub"
interface=
"com.spacetech.gateway.MessageApiHub"
check=
"false"
/>
<dubbo:reference
id=
"microlectureApiHub"
interface=
"com.spacetech.gateway.MicrolectureApiHub"
check=
"false"
/>
<dubbo:reference
id=
"homeworkApiHub"
interface=
"com.spacetech.gateway.HomeworkApiHub"
check=
"false"
/>
<dubbo:reference
id=
"examScoreApiHub"
interface=
"com.spacetech.gateway.ExamScoreApiHub"
check=
"false"
/>
<dubbo:reference
id=
"oaApiHub"
interface=
"com.spacetech.gateway.OaApiHub"
check=
"false"
/>
<dubbo:reference
id=
"baseDataApiHub"
interface=
"com.spacetech.gateway.BaseDataApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"userApiHub"
interface=
"com.spacetech.gateway.UserApiHub"
check=
"false"
/>
<dubbo:reference
id=
"wechatApiHub"
interface=
"com.spacetech.gateway.WechatApiHub"
check=
"false"
/>
<dubbo:reference
id=
"evaluationApiHub"
interface=
"com.spacetech.gateway.EvaluationApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"parentlicenseApiHub"
interface=
"com.spacetech.gateway.ParentlicenseApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"logApiHub"
interface=
"com.spacetech.gateway.LogApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"tokenApiHub"
interface=
"com.spacetech.gateway.TokenApiHub"
check=
"false"
/>
<dubbo:reference
id=
"faceApiHub"
interface=
"com.spacetech.gateway.FaceApiHub"
check=
"false"
/>
<dubbo:reference
id=
"growthApiHub"
interface=
"com.spacetech.gateway.GrowthApiHub"
check=
"false"
timeout=
"90000"
retries=
"2"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"surveyApiHub"
interface=
"com.spacetech.gateway.SurveyApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"attendanceApiHub"
interface=
"com.spacetech.gateway.AttendanceApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"registrationApiHub"
interface=
"com.spacetech.gateway.RegistrationApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"metaqApiHub"
interface=
"com.spacetech.gateway.MetaqApiHub"
check=
"false"
>
<dubbo:method
name=
"callApiAsync"
async=
"true"
return=
"false"
/>
</dubbo:reference>
<dubbo:reference
id=
"payApiHub"
interface=
"com.spacetech.gateway.PayApiHub"
check=
"false"
/>
<dubbo:reference
id=
"sqxyApiHub"
interface=
"com.spacetech.gateway.SqxyApiHub"
check=
"false"
/>
<dubbo:reference
id=
"qualityApiHub"
interface=
"com.spacetech.gateway.QualityApiHub"
check=
"false"
/>
</beans>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment