scheduler

package
v1.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddJob

func AddJob(collection *dependencyinjection.ServiceCollection, jobCtor interface{})

func AddJobs

func AddJobs(collection *dependencyinjection.ServiceCollection, jobListCtor ...interface{})

func GetLogger

func GetLogger(logID int64) (*logrus.Logger, error)

func IsDone

func IsDone(logID int64) bool

func UseXxlJob

func UseXxlJob(collection *dependencyinjection.ServiceCollection)

Types

type ExecutorOptions

type ExecutorOptions struct {
	ServerAddr   string        `mapstructure:"serverAddr" config:"serverAddr"`
	AccessToken  string        `mapstructure:"accessToken" config:"accessToken"`
	Timeout      time.Duration `mapstructure:"timeout" config:"timeout"`
	ExecutorIp   string        `mapstructure:"ip" config:"ip"`
	ExecutorPort string        `mapstructure:"port" config:"port"`
	RegistryKey  string        `mapstructure:"registryKey" config:"registryKey"` // application name
	// contains filtered or unexported fields
}

func (*ExecutorOptions) BuildExecutor

func (ops *ExecutorOptions) BuildExecutor() xxl.Executor

BuildExecutor 构造执行器

type JobContext

type JobContext struct {
	*xxl.RunReq
	Logger  Logger
	Context context.Context
}

func GetContext

func GetContext(ctx context.Context, request *xxl.RunReq) *JobContext

func (*JobContext) Done

func (ctx *JobContext) Done(msg string) string

Done 任务完成返回

func (*JobContext) Error

func (ctx *JobContext) Error(args ...interface{})

Error 任务发生错误

func (*JobContext) Report

func (ctx *JobContext) Report(format string, args ...interface{})

Report 上报日志

type JobHandler

type JobHandler interface {
	// Execute 任务的执行函数
	Execute(cxt *JobContext) (msg string)
	// GetJobName 自定义任务的名字
	GetJobName() string
}

type Logger

type Logger interface {
	Info(format string, args ...interface{})
	Error(args ...interface{})
	Done(msg string) string
}

type XxlJobLogger

type XxlJobLogger struct {
	// contains filtered or unexported fields
}

func NewXxlJobLogger

func NewXxlJobLogger(logID int64) (*XxlJobLogger, error)

func (*XxlJobLogger) Done

func (x *XxlJobLogger) Done(msg string) string

func (*XxlJobLogger) Error

func (x *XxlJobLogger) Error(args ...interface{})

func (*XxlJobLogger) Info

func (x *XxlJobLogger) Info(format string, args ...interface{})

type XxlJobService

type XxlJobService struct {
	Executor xxl.Executor
	// contains filtered or unexported fields
}

XxlJobService as IHostService

func NewXxlJobService

func NewXxlJobService(configuration abstractions.IConfiguration, environment *abstractions.HostEnvironment, jobList []JobHandler) *XxlJobService

func (*XxlJobService) Run

func (service *XxlJobService) Run() error

func (*XxlJobService) Stop

func (service *XxlJobService) Stop() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL