xxl-job-executorのジンミドルウェア

xxl-351122016-executorのginミドルウェアの
背景
xxl-job-executor-goはxxl-jobのgolangexecutorであり、独立して実行できます。プロジェクトまたはフレームワーク(ginフレームワークなど)と統合して1つのサービスにマージする必要がある場合があります。 、このプロジェクトが誕生しました。

エグゼキュータプロジェクトアドレス
https://github.com/xxl-job/xxl-job-executor-go

ginサンプル
パッケージmainとの統合

import(
"github.com/gin-gonic/gin"
"github.com/gin-middleware/xxl-job-executor"
"github.com/xxl-job/xxl-job-executor-go"
"github.com/ xxl-job / xxl-job-executor-go / example / task "
" log "

const Port = "9999"

func main(){
// executor
execを初期化します:= xxl.NewExecutor(
xxl.ServerAddr( " http://127.0.0.1/xxl-job-admin ")、
xxl.AccessToken( "")、//注文をリクエストしますブランド(デフォルトでは空)
xxl.ExecutorIp( "127.0.0.1")、//自動的に
xxl.ExecutorPort(Port)を取得できます、//デフォルト9999(ここでginサービスでポートを開始するには1から)
xxl.RegistryKey( "golang-jobs")、//実行者名

exec.Init()
// ginルーティングに追加
r:= gin.Default()
xxl_job_executor_gin.XxlJobMux(r、exec)

//注册gin的handler
r.GET("ping", func(cxt *gin.Context) {
    cxt.JSON(200, "pong")
})

//注册任务handler
exec.RegTask("task.test", task.Test)
exec.RegTask("task.test2", task.Test2)
exec.RegTask("task.panic", task.Panic)

log.Fatal(r.Run(":" + Port))

}
https://github.com/users/zhuoch643791/projects/1
https://github.com/users/zhuoch643791/projects/1?fullscreen=true
https://github.com/users/zhuoch643791/projects/1 ?vk143
https://github.com/users/zhuoch643791/projects/1?alhpu
https://github.com/users/zhuoch643791/projects/1?11968
https://github.com/users/zhuoch643791/projects/ 2
https://github.com/users/zhuoch643791/projects/2?fullscreen=true
https://github.com/users/zhuoch643791/projects/2?MZGBJ
https://github.com/users/zhuoch643791/projects / 2?jurqd
https://github.com/users/zhuoch643791/projects/2?56625
https://github.com/users/zhuoch643791/projects/3
https://github.com/users/zhuoch643791/projects/ 3?fullscreen = true
https://github.com/users/zhuoch643791/projects/3?hIUWo
https://github.com/users/zhuoch643791/projects/3?zlqtc
https://github.com/users/zhuoch643791/projects/3? 36700
https://github.com/users/zhuoch643791/projects/4
https://github.com/users/zhuoch643791/projects/4?fullscreen=true
https://github.com/users/zhuoch643791/projects/4 ?cj5Z1
https://github.com/users/zhuoch643791/projects/4?sysnm
https://github.com/users/zhuoch643791/projects/4?15092
https://github.com/users/zhuoch643791/projects/ 5
https://github.com/users/zhuoch643791/projects/5?fullscreen=true
https://github.com/users/zhuoch643791/projects/5?h5VVZ
https://github.com/users/zhuoch643791/projects / 5?sfpbh
https://github.com/users/zhuoch643791/projects/5?35979
https://github.com/users/zhuoch643791/projects/6
https://github.com/users/zhuoch643791/projects/6?fullscreen= true
https://github.com/users/zhuoch643791/projects/6?rpU2K
https://github.com/users/zhuoch643791/projects/6?jjitd
https://github.com/users/zhuoch643791/projects/6 ?29818
https://github.com/users/zhuoch643791/projects/7
https://github.com/users/zhuoch643791/projects/7?fullscreen=true
https://github.com/users/zhuoch643791/projects/ 7?Vu427
https://github.com/users/zhuoch643791/projects/7?oumji
https://github.com/users/zhuoch643791/projects/7?24889
https://github.com/users/zhuoch643791/projects / 8
https://github.com/users/zhuoch643791/projects/8?fullscreen=true
https://github.com/users/zhuoch643791/projects/8?wN19S
https://github.com/users/zhuoch643791/projects/ 8?fclwa
https://github.com/users/zhuoch643791/projects/8?75510
https://github.com/users/zhuoch643791/projects/9
https://github.com/users/zhuoch643791/projects/9 ?fullscreen = true
https://github.com/users/zhuoch643791/projects/9?7o6VS
https://github.com/users/zhuoch643791/projects/9?petzt
https://github.com/users/zhuoch643791/ projects / 9?00880
https://github.com/users/zhuoch643791/projects/10
https://github.com/users/zhuoch643791/projects/10?fullscreen=true
https://github.com/users/zhuoch643791 / projects / 10?734S4
https://github.com/users/zhuoch643791/projects/10?yulxu
https://github.com/users/zhuoch643791/projects/10?40751
https://github.com/users/zhuoch643791/projects/11
https ://github.com/users/zhuoch643791/projects/11?fullscreen = true
https://github.com/users/zhuoch643791/projects/11?6w1z6
https://github.com/users/zhuoch643791/projects/11 ?skbes
https://github.com/users/zhuoch643791/projects/11?90975
https://github.com/users/zhuoch643791/projects/12
https://github.com/users/zhuoch643791/projects/12? fullscreen = true
https://github.com/users/zhuoch643791/projects/12?4WP2J
https://github.com/users/zhuoch643791/projects/12?dqkyu
https://github.com/users/zhuoch643791/projects / 12?26658
https://github.com/users/zhuoch643791/projects/13
https://github.com/users/zhuoch643791/projects/13?fullscreen=true
https://github.com/users/zhuoch643791/projects/13? 01LPt
https://github.com/users/zhuoch643791/projects/13?pramp
https://github.com/users/zhuoch643791/projects/13?77750
https://github.com/users/zhuoch643791/projects/14
https://github.com/users/zhuoch643791/projects/14?fullscreen=true
https://github.com/users/zhuoch643791/projects/14?1NbI8
https://github.com/users/zhuoch643791/projects/ 14?zvgnb
https://github.com/users/zhuoch643791/projects/14?17373
https://github.com/users/zhuoch643791/projects/15
https://github.com/users/zhuoch643791/projects/15 ?fullscreen = true
https://github.com/users/zhuoch643791/projects/15?e8B6v
https://github.com/users/zhuoch643791/projects/15?mndoc
https://github.com/users/zhuoch643791/projects/15? 84952
https://github.com/users/zhuoch643791/projects/16
https://github.com/users/zhuoch643791/projects/16?fullscreen=true
https://github.com/users/zhuoch643791/projects/16 ?E46fZ
https://github.com/users/zhuoch643791/projects/16?tbzgz
https://github.com/users/zhuoch643791/projects/16?02069
https://github.com/users/zhuoch643791/projects/ 17
https://github.com/users/zhuoch643791/projects/17?fullscreen=true
https://github.com/users/zhuoch643791/projects/17?7891p
https://github.com/users/zhuoch643791/projects / 17?gyifn
https://github.com/users/zhuoch643791/projects/17?33495
https://github.com/users/zhuoch643791/projects/18
https://github.com/users/zhuoch643791/projects/18?fullscreen= true
https://github.com/users/zhuoch643791/projects/18?dUpBZ
https://github.com/users/zhuoch643791/projects/18?lggdg
https://github.com/users/zhuoch643791/projects/18 ?24778
https://github.com/users/zhuoch643791/projects/19
https://github.com/users/zhuoch643791/projects/19?fullscreen=true
https://github.com/users/zhuoch643791/projects/ 19?fH1u2
https://github.com/users/zhuoch643791/projects/19?jwcpo
https://github.com/users/zhuoch643791/projects/19?64295
https://github.com/users/zhuoch643791/projects / 20
https://github.com/users/zhuoch643791/projects/20?fullscreen=true
https://github.com/users/zhuoch643791/projects/20?X0uo3
https://github.com/users/zhuoch643791/projects/ 20?zqrkg
https://github.com/users/zhuoch643791/projects/20?17979
https://github.com/users/zhuoch643791/projects/21
https://github.com/users/zhuoch643791/projects/21 ?fullscreen = true
https://github.com/users/zhuoch643791/projects/21?3ptE1
https://github.com/users/zhuoch643791/projects/21?rovay
https://github.com/users/zhuoch643791/ projects / 21?84121
https://github.com/users/zhuoch643791/projects/22
https://github.com/users/zhuoch643791/projects/22?fullscreen=true
https://github.com/users/zhuoch643791 / projects / 22?694la
https://github.com/users/zhuoch643791/projects/22?bpcol
https://github.com/users/zhuoch643791/projects/22?50446
https://github.com/users/zhuoch643791/projects/23
https ://github.com/users/zhuoch643791/projects/23?fullscreen = true
https://github.com/users/zhuoch643791/projects/23?F2g1W
https://github.com/users/zhuoch643791/projects/23 ?suokh
https://github.com/users/zhuoch643791/projects/23?28929
https://github.com/users/zhuoch643791/projects/24
https://github.com/users/zhuoch643791/projects/24? fullscreen = true
https://github.com/users/zhuoch643791/projects/24?r6Ia7
https://github.com/users/zhuoch643791/projects/24?deqcu
https://github.com/users/zhuoch643791/projects / 24?77315
https://github.com/users/zhuoch643791/projects/25
https://github.com/users/zhuoch643791/projects/25?fullscreen=true
https://github.com/users/zhuoch643791/projects/25? l5650
https://github.com/users/zhuoch643791/projects/25?wkhlp
https://github.com/users/zhuoch643791/projects/25?10163
https://github.com/users/zhuoch643791/projects/26
https://github.com/users/zhuoch643791/projects/26?fullscreen=true
https://github.com/users/zhuoch643791/projects/26?G6Z0y
https://github.com/users/zhuoch643791/projects/ 26?cnriv
https://github.com/users/zhuoch643791/projects/26?67017
https://github.com/users/zhuoch643791/projects/27
https://github.com/users/zhuoch643791/projects/27 ?fullscreen = true
https://github.com/users/zhuoch643791/projects/27?d5G08
https://github.com/users/zhuoch643791/projects/27?rznnc
https://github.com/users/zhuoch643791/projects/27? 84346
https://github.com/users/zhuoch643791/projects/28
https://github.com/users/zhuoch643791/projects/28?fullscreen=true
https://github.com/users/zhuoch643791/projects/28 ?NUaWv
https://github.com/users/zhuoch643791/projects/28?zlwvk
https://github.com/users/zhuoch643791/projects/28?05855
https://github.com/users/zhuoch643791/projects/ 29
https://github.com/users/zhuoch643791/projects/29?fullscreen=true
https://github.com/users/zhuoch643791/projects/29?O2Dv9
https://github.com/users/zhuoch643791/projects / 29?fhmdc
https://github.com/users/zhuoch643791/projects/29?34382
https://github.com/users/zhuoch643791/projects/30
https://github.com/users/zhuoch643791/projects/30?fullscreen= true
https://github.com/users/zhuoch643791/projects/30?3AfEW
https://github.com/users/zhuoch643791/projects/30?slzkn
https://github.com/users/zhuoch643791/projects/30 ?01467
https://github.com/users/zhuoch643791/projects/31
https://github.com/users/zhuoch643791/projects/31?fullscreen=true
https://github.com/users/zhuoch643791/projects/ 31?dwvv8
https://github.com/users/zhuoch643791/projects/31?zdjaj
https://github.com/users/zhuoch643791/projects/31?27125
https://github.com/users/zhuoch643791/projects / 32
https://github.com/users/zhuoch643791/projects/32?fullscreen=true
https://github.com/users/zhuoch643791/projects/32?Y0FRX
https://github.com/users/zhuoch643791/projects/ 32?mrpwu
https://github.com/users/zhuoch643791/projects/32?53182
https://github.com/users/zhuoch643791/projects/33
https://github.com/users/zhuoch643791/projects/33 ?fullscreen = true
https://github.com/users/zhuoch643791/projects/33?Pzf7x
https://github.com/users/zhuoch643791/projects/33?xujel
https://github.com/users/zhuoch643791/ projects / 33?76495
https://github.com/users/zhuoch643791/projects/34
https://github.com/users/zhuoch643791/projects/34?fullscreen=true
https://github.com/users/zhuoch643791 / projects / 34?4E05N
https://github.com/users/zhuoch643791/projects/34?lipvo
https://github.com/users/zhuoch643791/projects/34?13315
https://github.com/users/zhuoch643791/projects/35
https ://github.com/users/zhuoch643791/projects/35?fullscreen = true
https://github.com/users/zhuoch643791/projects/35?14nSZ
https://github.com/users/zhuoch643791/projects/35 ?bahjv
https://github.com/users/zhuoch643791/projects/35?97905
https://github.com/users/zhuoch643791/projects/36
https://github.com/users/zhuoch643791/projects/36? fullscreen = true
https://github.com/users/zhuoch643791/projects/36?6bY80
https://github.com/users/zhuoch643791/projects/36?sbauk
https://github.com/users/zhuoch643791/projects / 36?39875
https://github.com/users/zhuoch643791/projects/37
https://github.com/users/zhuoch643791/projects/37?fullscreen=true
https://github.com/users/zhuoch643791/projects/37? 3l27B
https://github.com/users/zhuoch643791/projects/37?sluds
https://github.com/users/zhuoch643791/projects/37?74081
https://github.com/users/zhuoch643791/projects/38
https://github.com/users/zhuoch643791/projects/38?fullscreen=true
https://github.com/users/zhuoch643791/projects/38?1GyvX
https://github.com/users/zhuoch643791/projects/ 38?dmqbo
https://github.com/users/zhuoch643791/projects/38?71145
https://github.com/users/zhuoch643791/projects/39
https://github.com/users/zhuoch643791/projects/39 ?fullscreen = true
https://github.com/users/zhuoch643791/projects/39?55DTF
https://github.com/users/zhuoch643791/projects/39?zdyme
https://github.com/users/zhuoch643791/projects/39? 68990
https://github.com/users/zhuoch643791/projects/40
https://github.com/users/zhuoch643791/projects/40?fullscreen=true
https://github.com/users/zhuoch643791/projects/40 ?xmW8g
https://github.com/users/zhuoch643791/projects/40?bqrds
https://github.com/users/zhuoch643791/projects/40?85661
https://github.com/users/zhuoch643791/projects/ 41
https://github.com/users/zhuoch643791/projects/41?fullscreen=true
https://github.com/users/zhuoch643791/projects/41?a5893
https://github.com/users/zhuoch643791/projects / 41?cibbr
https://github.com/users/zhuoch643791/projects/41?77895

おすすめ

転載: blog.51cto.com/14492926/2601493