Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7e651b55
authored
Jun 29, 2017
by
xuxueli
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
springboot版本执行器,取消XML配置,改为类配置方式; ( From github user:FelixXu )
parent
628a1ac5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
55 deletions
doc/XXL-JOB官方文档.md
xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/mvc/handler/IndexController.java
xxl-job-executor-springboot-example/src/main/resources/application.properties
xxl-job-executor-springboot-example/src/main/resources/applicationcontext-xxl-job.xml
xxl-job-executor-springboot-example/src/main/resources/xxl-job-executor.properties
doc/XXL-JOB官方文档.md
View file @
7e651b55
# 《分布
式任务调度平台XXL-JOB》
# 《分布
式任务调度平台XXL-JOB》
...
...
@@ -867,6 +867,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
-
6、执行器重复注册问题修复;
-
7、任务线程轮空30次后自动销毁,降低低频任务的无效线程消耗。
-
8、执行器任务执行结果批量回调,降低回调频率提升执行器性能;
-
9、springboot版本执行器,取消XML配置,改为类配置方式;
#### TODO LIST
-
1、任务权限管理:执行器为粒度分配权限,核心操作校验权限;
...
...
xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
View file @
7e651b55
package
com
.
xxl
.
job
.
executor
.
core
.
config
;
import
com.xxl.job.core.executor.XxlJobExecutor
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.ImportResource
;
@Configuration
@
ImportResource
(
"classpath:applicationcontext-xxl-job.xml
"
)
@
ComponentScan
(
basePackages
=
"com.xxl.job.executor.service.jobhandler
"
)
public
class
XxlJobConfig
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
XxlJobConfig
.
class
);
@Value
(
"${xxl.job.admin.addresses}"
)
private
String
addresses
;
@Value
(
"${xxl.job.executor.appname}"
)
private
String
appname
;
@Value
(
"${xxl.job.executor.ip}"
)
private
String
ip
;
@Value
(
"${xxl.job.executor.port}"
)
private
int
port
;
@Value
(
"${xxl.job.executor.logpath}"
)
private
String
logpath
;
@Bean
(
initMethod
=
"start"
,
destroyMethod
=
"destroy"
)
public
XxlJobExecutor
xxlJobExecutor
()
{
logger
.
error
(
"------------ xxlJobExecutor -----------"
);
XxlJobExecutor
xxlJobExecutor
=
new
XxlJobExecutor
();
xxlJobExecutor
.
setIp
(
ip
);
xxlJobExecutor
.
setPort
(
port
);
xxlJobExecutor
.
setAppName
(
appname
);
xxlJobExecutor
.
setAdminAddresses
(
addresses
);
xxlJobExecutor
.
setLogPath
(
logpath
);
return
xxlJobExecutor
;
}
}
\ No newline at end of file
xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/mvc/handler/IndexController.java
View file @
7e651b55
...
...
@@ -12,7 +12,7 @@ public class IndexController {
@RequestMapping
(
"/"
)
@ResponseBody
String
index
()
{
return
"xxl job
is
running."
;
return
"xxl job
executor
running."
;
}
}
\ No newline at end of file
xxl-job-executor-springboot-example/src/main/resources/application.properties
View file @
7e651b55
...
...
@@ -4,5 +4,14 @@ server.port=8081
# log config
logging.config
=
classpath:logback.xml
# xxl-job
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
xxl.job.admin.addresses
=
http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address
xxl.job.executor.appname
=
xxl-job-executor-example
xxl.job.executor.ip
=
xxl.job.executor.port
=
9999
### xxl-job log path
xxl.job.executor.logpath
=
/data/applogs/xxl-job/jobhandler/
xxl-job-executor-springboot-example/src/main/resources/applicationcontext-xxl-job.xml
deleted
100644 → 0
View file @
628a1ac5
<?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:context=
"http://www.springframework.org/schema/context"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
<bean
id=
"propertyConfigurer"
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<property
name=
"fileEncoding"
value=
"utf-8"
/>
<property
name=
"locations"
>
<list>
<value>
classpath*:xxl-job-executor.properties
</value>
</list>
</property>
</bean>
<!-- ********************************* 基础配置 ********************************* -->
<!-- 配置01、JobHandler 扫描路径 -->
<context:component-scan
base-package=
"com.xxl.job.executor.service.jobhandler"
/>
<!-- 配置02、执行器 -->
<bean
id=
"xxlJobExecutor"
class=
"com.xxl.job.core.executor.XxlJobExecutor"
init-method=
"start"
destroy-method=
"destroy"
>
<!-- 执行器IP[选填],为空则自动获取 -->
<property
name=
"ip"
value=
"${xxl.job.executor.ip}"
/>
<!-- 执行器端口号[必须] -->
<property
name=
"port"
value=
"${xxl.job.executor.port}"
/>
<!-- 执行器AppName[选填],为空则关闭自动注册 -->
<property
name=
"appName"
value=
"${xxl.job.executor.appname}"
/>
<!-- 执行器注册中心地址[选填],为空则关闭自动注册 -->
<property
name=
"adminAddresses"
value=
"${xxl.job.admin.addresses}"
/>
<!-- 执行器日志路径[必填] -->
<property
name=
"logPath"
value=
"${xxl.job.executor.logpath}"
/>
</bean>
</beans>
\ No newline at end of file
xxl-job-executor-springboot-example/src/main/resources/xxl-job-executor.properties
deleted
100644 → 0
View file @
628a1ac5
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
xxl.job.admin.addresses
=
http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address
xxl.job.executor.appname
=
xxl-job-executor-example
xxl.job.executor.ip
=
xxl.job.executor.port
=
9999
### xxl-job log path
xxl.job.executor.logpath
=
/data/applogs/xxl-job/jobhandler/
\ 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