6 Star 11 Fork 1

distill/distill-infra

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
job.go 918 Bytes
一键复制 编辑 原始数据 按行查看 历史
胡正阳 提交于 2021-09-16 18:14 . integration the corba and go-restful
package job
import (
"context"
infra "gitee.com/banyanhouse/distill-infra"
"gitee.com/banyanhouse/distill-infra/hook"
"k8s.io/klog/v2"
"time"
)
var job Jobber
type Jobber interface {
Run()
}
type BaseJobber struct {
}
func (b BaseJobber) Run() {
klog.Info("BaseJobber Run Starting...")
time.Sleep(3 * time.Second)
klog.Info("BaseJobber Run Finished.")
}
type JobStarter struct {
infra.BaseStarter
}
func (j *JobStarter) Setup(ctx context.Context) {
conf := infra.Props(ctx)
klog.Info("JobStarter Setup Begin.")
klog.Info(conf.App.Name)
job = new(BaseJobber)
klog.Info("JobStarter Setup Finish.")
}
func (j *JobStarter) Start(ctx context.Context) {
klog.Info("JobStarter Start Begin.")
job.Run()
klog.Info("JobStarter Start Finish.")
hook.CloseBlockHookStarter()
}
func (j *JobStarter) Stop(ctx context.Context) {
klog.Info("JobStarter Stop Begin.")
klog.Info("JobStarter Stop Finish.")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/banyanhouse/distill-infra.git
git@gitee.com:banyanhouse/distill-infra.git
banyanhouse
distill-infra
distill-infra
v0.0.25

搜索帮助