common

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionRun      = baseApi + "/run"       // 启动任务
	ActionKill     = baseApi + "/kill"      // 终止任务
	ActionLog      = baseApi + "/log"       // 任务日志
	ActionBeat     = baseApi + "/heartbeat" // 心跳检测
	ActionIdleBeat = baseApi + "/busy"      // 忙碌检测
)
View Source
const (
	Success  = 200
	NotFount = 404
	Error    = 500
)
View Source
const HttpDefaultTimeout = 8 * time.Second
View Source
const RouteRegTaskPath = "/register/{clientId}"
View Source
const RouteRegTaskTpl = "/register/%s"
View Source
const RouteSchedulePath = "/schedule/{clientId}"
View Source
const RouteScheduleTpl = "/schedule/%s"

Variables

This section is empty.

Functions

This section is empty.

Types

type CallElement

type CallElement struct {
	HandleCode      int    `json:"handleCode"` //200表示正常,500表示失败
	HandleMsg       string `json:"handleMsg"`
	JobId           string `json:"jobId"`
	InstanceId      int    `json:"instanceId"`
	ExecutorHandler string `json:"ExecutorHandler"`
}

CallElement 执行器执行完任务后,回调任务结果时使用

func Callback

func Callback(req RunReq, code int, msg string) CallElement

Callback 封装任务回调

type RegReq

type RegReq struct {
	ClientId string   `json:"clientId"`
	Handlers []string `json:"handlers"`
}

type RunReq

type RunReq struct {
	JobID           string                 `json:"jobId"`           // 任务ID
	ExecutorHandler string                 `json:"executorHandler"` // 任务标识
	InstanceId      int                    `json:"instanceId"`      // 任务实例ID
	Time            time.Time              `json:"time"`            // 出发请求的时间
	Data            map[string]interface{} `json:"data"`
}

RunReq 触发任务请求参数

type ScheduleResponse

type ScheduleResponse struct {
	app.Response
	Data RunReq `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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