-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
659 additions
and
713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,5 @@ | ||
{ | ||
"MD001": true, | ||
"MD002": false, | ||
"MD003": false, | ||
"MD004": false, | ||
"MD005": false, | ||
"MD006": false, | ||
"MD007": false, | ||
"MD008": false, | ||
"MD009": false, | ||
"MD010": false, | ||
"MD011": false, | ||
"MD012": false, | ||
"MD013": false, | ||
"MD014": false, | ||
"MD015": false, | ||
"MD016": false, | ||
"MD017": false, | ||
"MD018": false, | ||
"MD019": false, | ||
"MD020": false, | ||
"MD021": false, | ||
"MD022": false, | ||
"MD023": false, | ||
"MD024": false, | ||
"MD025": false, | ||
"MD026": false, | ||
"MD027": false, | ||
"MD028": false, | ||
"MD029": false, | ||
"MD030": false, | ||
"MD031": true, | ||
"MD032": false, | ||
"default": true, | ||
"MD033": false, | ||
"MD034": false, | ||
"MD035": false, | ||
"MD036": false, | ||
"MD037": true, | ||
"MD038": true, | ||
"MD039": false, | ||
"MD040": false, | ||
"MD041": false, | ||
"MD042": false, | ||
"MD043": false, | ||
"MD044": false, | ||
"MD045": false, | ||
"MD046": false, | ||
"MD047": false, | ||
"MD048": false, | ||
"MD049": false, | ||
"MD050": false | ||
"MD013": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# jupiter接入xxl-job分布式调度中心模块 | ||
|
||
example: /example/xxl-job | ||
用法如下: | ||
|
||
1. 增加配置: | ||
以下是配置说明 | ||
|
||
```toml | ||
[xxl] | ||
[xxl.job] | ||
[xxl.job.admin] | ||
address = "http://127.0.0.1:8080/xxl-job-admin" # 注意换成XXL调度中心对应环境的域名 | ||
access_token = "jupiter-token" # 注册xxl-job执行器需要的token信息 | ||
appname = "jupiter-xxl-job-demo" # 启动执行器的名称 | ||
port = "59000" # 启动执行器的服务端口 | ||
log_dir = "./" # 执行器产生的日志文件目录 | ||
# 以下的配置建议使用默认 | ||
#host = "" # 启动执行器的主机。默认通过ip.get注册。确保xxl-job能调度该地址 | ||
debug = true # 是否开启debug模式 | ||
switch = true # 执行器的总开关 | ||
registry_group = "EXECUTOR" # 执行器组 | ||
#timeout = 2000 # 接口超时时间 | ||
``` | ||
|
||
1. 示例用法: | ||
|
||
```go | ||
func main() { | ||
eng := NewEngine() | ||
eng.RegisterHooks(hooks.Stage_AfterStop, func() { | ||
fmt.Println("exit jupiter app ...") | ||
}) | ||
if err := eng.Run(); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
|
||
type Engine struct { | ||
jupiter.Application | ||
} | ||
|
||
func NewEngine() *Engine { | ||
eng := &Engine{} | ||
if err := eng.Startup( | ||
xgo.ParallelWithError( | ||
eng.startXxlJob, | ||
), | ||
); err != nil { | ||
xlog.Panic("startup engine", xlog.Any("err", err)) | ||
} | ||
return eng | ||
} | ||
|
||
func (eng *Engine) startXxlJob() error { | ||
executor := xxl.StdNewExecutor() | ||
// 注册定时任务 | ||
executor.RegXJob( | ||
NewTest(), | ||
NewTest2(), | ||
) | ||
eng.Executor(executor) | ||
return nil | ||
} | ||
|
||
|
||
// =======以下为示例任务test.go========= | ||
type Test struct{} | ||
|
||
func NewTest() *Test { | ||
return &Test{} | ||
} | ||
|
||
// 任务名称 | ||
func (t *Test) GetJobName() string { | ||
return "test" | ||
} | ||
|
||
// xxl-job 分布式调度任务执行函数 | ||
func (t *Test) Run(ctx context.Context, param *executor.RunReq) (msg string, err error) { | ||
//使用xxl-logger日志即可在xxl-job平台上看到日志 | ||
logger.Info(param.LogID, "start run...") | ||
logger.Info(param.LogID, fmt.Sprintf("job param is: %s", param.ExecutorParams)) | ||
fmt.Println("test job has been executed") | ||
return "success", nil | ||
} | ||
``` | ||
|
||
```txt | ||
注:调度器中的停止某项任务是停止调度接下来的任务。如果用中途中止某个正在进行中的定时任务,请使用ctx.Done() | ||
``` |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
## rotate | ||
# rotate | ||
|
||
rotate用于对日志文件进行切分。rotate fork自[lumberjack](https://github.com/sevenNt/lumberjack)。在lumberjack对文件夹权限、日志格式、对外API等做了稍许调整。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# JOIN US | ||
|
||
## 加入开发群 | ||
|
||
### 钉钉群 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Docker | ||
|
||
## 1.2 docker安装 | ||
|
||
### 1.2.1 安装 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## 1.3 二进制安装 | ||
# 1.3 二进制安装 | ||
|
||
```bash | ||
git clone https://github.com/douyu/juno-install.git | ||
|
Oops, something went wrong.