Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
tool
/
xxl-job
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f1a6f812
authored
May 23, 2019
by
xuxueli
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增Jboot执行器Sample示例项目
1 parent
47ce0448
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
239 deletions
xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/resources/xxl-job-executor.properties
xxl-job-executor-samples/xxl-job-executor-sample-jboot/pom.xml
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/JbootApp.java → xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/JbootApp.java
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/config/JbootConfig.java
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/controller/IndexController.java
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/resources/jboot.properties
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/resources/logback.xml
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/test/java/com/xuxueli/AppTest.java
xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/resources/xxl-job-executor.properties
View file @
f1a6f81
...
...
@@ -4,7 +4,7 @@ xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address
xxl.job.executor.appname
=
xxl-job-executor-sample
xxl.job.executor.ip
=
xxl.job.executor.port
=
999
5
xxl.job.executor.port
=
999
4
### xxl-job, access token
xxl.job.accessToken
=
...
...
xxl-job-executor-samples/xxl-job-executor-sample-jboot/pom.xml
View file @
f1a6f81
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
xxl-job-executor-samples
</artifactId>
<groupId>
com.xuxueli
</groupId>
<artifactId>
xxl-job-executor-samples
</artifactId>
<version>
2.1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
xxl-job-executor-sample-jboot
</artifactId>
<name>
${project.artifactId}
</name>
<description>
Example executor project for spring boot.
</description>
<url>
http://www.xuxueli.com/
</url>
<packaging>
jar
</packaging>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.7
</maven.compiler.source>
<maven.compiler.target>
1.7
</maven.compiler.target>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
</properties>
<dependencies>
<!-- jboot -->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
<groupId>
io.jboot
</groupId>
<artifactId>
jboot
</artifactId>
<version>
2.0.9
</version>
</dependency>
<!-- xxl-job-core -->
...
...
@@ -38,12 +32,12 @@
</dependency>
<dependency>
<groupId>
io.jboot
</groupId>
<artifactId>
jboot
</artifactId>
<version>
2.0.9
</version>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-core
</artifactId>
...
...
@@ -58,72 +52,4 @@
</dependencies>
<build>
<resources>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.xml
</include>
</includes>
<filtering>
true
</filtering>
</resource>
<resource>
<directory>
src/main/resources
</directory>
<includes>
<include>
**/*
</include>
</includes>
<filtering>
true
</filtering>
</resource>
<resource>
<directory>
src/main/webapp
</directory>
<includes>
<include>
**/
</include>
</includes>
<filtering>
true
</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
appassembler-maven-plugin
</artifactId>
<version>
1.10
</version>
<configuration>
<assembleDirectory>
${project.build.directory}/app
</assembleDirectory>
<repositoryName>
lib
</repositoryName>
<binFolder>
bin
</binFolder>
<configurationDirectory>
webRoot
</configurationDirectory>
<copyConfigurationDirectory>
true
</copyConfigurationDirectory>
<configurationSourceDirectory>
src/main/resources
</configurationSourceDirectory>
<repositoryLayout>
flat
</repositoryLayout>
<encoding>
UTF-8
</encoding>
<logsDirectory>
logs
</logsDirectory>
<tempDirectory>
tmp
</tempDirectory>
<programs>
<program>
<mainClass>
io.jboot.Jboot
</mainClass>
<id>
jboot
</id>
<platforms>
<platform>
windows
</platform>
<platform>
unix
</platform>
</platforms>
</program>
</programs>
</configuration>
</plugin>
</plugins>
</build>
</project>
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/JbootApp.java
→
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/
executor/sample/jboot/
JbootApp.java
View file @
f1a6f81
package
com
.
xuxueli
;
package
com
.
xuxueli
.
executor
.
sample
.
jboot
;
import
io.jboot.app.JbootApplication
;
/**
* Jboot app
*
* @author https://github.com/souvc
*/
public
class
JbootApp
{
public
static
void
main
(
String
[]
args
)
{
...
...
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/config/JbootConfig.java
View file @
f1a6f81
...
...
@@ -10,11 +10,7 @@ import io.jboot.core.listener.JbootAppListenerBase;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author https://github.com/souvc
*/
public
class
JbootConfig
extends
JbootAppListenerBase
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
JbootConfig
.
class
);
// ---------------------- xxl-job executor ----------------------
...
...
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/controller/IndexController.java
View file @
f1a6f81
...
...
@@ -3,13 +3,12 @@ package com.xuxueli.executor.sample.jboot.controller;
import
io.jboot.web.controller.JbootController
;
import
io.jboot.web.controller.annotation.RequestMapping
;
/**
* @author https://github.com/souvc
*/
@RequestMapping
(
"/"
)
public
class
IndexController
extends
JbootController
{
public
void
index
()
{
renderText
(
"xxl job executor running."
);
}
}
\ No newline at end of file
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/resources/jboot.properties
View file @
f1a6f81
#jboot
˿
#jboot
port
undertow.port
=
8082
...
...
@@ -8,7 +8,7 @@ xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address
xxl.job.executor.appname
=
xxl-job-executor-sample
xxl.job.executor.ip
=
xxl.job.executor.port
=
999
4
xxl.job.executor.port
=
999
5
### xxl-job, access token
xxl.job.accessToken
=
...
...
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/resources/logback.xml
View file @
f1a6f81
<?xml version="1.0" encoding="UTF-8"?>
<configuration
debug=
"false"
scan=
"true"
scanPeriod=
"1 seconds"
>
<!-- 级别从高到低 OFF 、 FATAL 、 ERROR 、 WARN 、 INFO 、 DEBUG 、 TRACE 、 ALL -->
<!-- 日志输出规则 根据当前ROOT 级别,日志输出时,级别高于root默认的级别时 会输出 -->
<!-- 以下 每个配置的 filter 是过滤掉输出文件里面,会出现高级别文件,依然出现低级别的日志信息,通过filter 过滤只记录本级别的日志 -->
<!-- scan 当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。 -->
<!-- scanPeriod 设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug 当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<contextName>
logback
</contextName>
<property
name=
"log.path"
value=
"/data/applogs/xxl-job/xxl-job-executor-sample-jboot.log"
/>
<!-- 动态日志级别 -->
<jmxConfigurator/>
<!-- 定义日志文件 输出位置 -->
<property
name=
"log_dir"
value=
"logs"
/>
<!-- 日志最大的历史 30天 -->
<property
name=
"maxHistory"
value=
"30"
/>
<!-- ConsoleAppender 控制台输出日志 -->
<appender
name=
"console"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
<!-- 设置日志输出格式 -->
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger - %msg%n
</pattern>
<pattern>
%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<!-- ERROR级别日志 -->
<!-- 滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 RollingFileAppender -->
<appender
name=
"ERROR"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 过滤器,只记录WARN级别的日志 -->
<!-- 果日志级别等于配置级别,过滤器会根据onMath 和 onMismatch接收或拒绝日志。 -->
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<!-- 设置过滤级别 -->
<level>
ERROR
</level>
<!-- 用于配置符合过滤条件的操作 -->
<onMatch>
ACCEPT
</onMatch>
<!-- 用于配置不符合过滤条件的操作 -->
<onMismatch>
DENY
</onMismatch>
</filter>
<!-- 最常用的滚动策略,它根据时间来制定滚动策略.既负责滚动也负责出发滚动 -->
<appender
name=
"file"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${log.path}
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!--日志输出位置 可相对、和绝对路径 -->
<fileNamePattern>
${log_dir}/error/%d{yyyy-MM-dd}/logs.log
</fileNamePattern>
<!-- 可选节点,控制保留的归档文件的最大数量,超出数量就删除旧文件假设设置每个月滚动,且<maxHistory>是6, 则只保存最近6个月的文件,删除之前的旧文件。注意,删除旧文件是,那些为了归档而创建的目录也会被删除 -->
<maxHistory>
${maxHistory}
</maxHistory>
<fileNamePattern>
${log.path}.%d{yyyy-MM-dd}.zip
</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>
<!-- 设置日志输出格式 -->
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger - %msg%n
<pattern>
%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</appender>
<!-- WARN级别日志 appender -->
<appender
name=
"WARN"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 过滤器,只记录WARN级别的日志 -->
<!-- 果日志级别等于配置级别,过滤器会根据onMath 和 onMismatch接收或拒绝日志。 -->
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<!-- 设置过滤级别 -->
<level>
WARN
</level>
<!-- 用于配置符合过滤条件的操作 -->
<onMatch>
ACCEPT
</onMatch>
<!-- 用于配置不符合过滤条件的操作 -->
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!--日志输出位置 可相对、和绝对路径 -->
<fileNamePattern>
${log_dir}/warn/%d{yyyy-MM-dd}/logs.log
</fileNamePattern>
<maxHistory>
${maxHistory}
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger - %msg%n
</pattern>
</encoder>
</appender>
<!-- INFO级别日志 appender -->
<appender
name=
"INFO"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
INFO
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${log_dir}/info/%d{yyyy-MM-dd}/logs.log
</fileNamePattern>
<maxHistory>
${maxHistory}
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger - %msg%n
</pattern>
</encoder>
</appender>
<!-- DEBUG级别日志 appender -->
<appender
name=
"DEBUG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
DEBUG
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${log_dir}/debug/%d{yyyy-MM-dd}/logs.log
</fileNamePattern>
<maxHistory>
${maxHistory}
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger - %msg%n
</pattern>
</encoder>
</appender>
<!-- TRACE级别日志 appender -->
<appender
name=
"TRACE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
TRACE
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${log_dir}/trace/%d{yyyy-MM-dd}/logs.log
</fileNamePattern>
<maxHistory>
${maxHistory}
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger - %msg%n
</pattern>
</encoder>
</appender>
<!-- root级别 DEBUG -->
<root>
<!-- 打印debug级别日志及以上级别日志 -->
<level
value=
"info"
/>
<!-- 控制台输出 -->
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<!-- 文件输出 -->
<!--<appender-ref ref="ERROR"/>-->
<!--<appender-ref ref="INFO"/>-->
<!--<appender-ref ref="WARN"/>-->
<!--<appender-ref ref="DEBUG"/>-->
<!--<appender-ref ref="TRACE"/>-->
<appender-ref
ref=
"file"
/>
</root>
</configuration>
\ No newline at end of file
xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/test/java/com/xuxueli/AppTest.java
View file @
f1a6f81
package
com
.
xuxueli
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* Unit test for simple App.
*/
public
class
AppTest
{
public
class
AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public
void
shouldAnswerWithTrue
()
{
assertTrue
(
true
);
public
void
shouldAnswerWithTrue
()
{
assertTrue
(
true
);
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment