ampq

package
v0.0.0-...-2dbdbee Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

View Source
const (
	CREATED  string = "CREATED"           //任务创建,但还没有开始执行
	REVOKED  string = "REVOKED"           //任务被取消执行
	STARTED  string = tasks.StateStarted  //任务在执行中
	SUCCESS  string = tasks.StateSuccess  //任务执行完成,结果为SUCCESS
	FAILURE  string = tasks.StateFailure  //任务执行完成,结果为FAILURE
	RECEIVED string = tasks.StateReceived //未使用
	PENDING  string = tasks.StatePending  //未使用
	RETRY    string = tasks.StateRetry    //未使用

	TopicActive  = "active"
	TopicFinger  = "finger"
	TopicPassive = "passive"
	TopicPocscan = "pocscan"
	TopicCustom  = "custom"

	TopicMQPrefix = "nemo_mq"
)

Variables

View Source
var CustomTaskWorkspaceMap = make(map[string]struct{})

CustomTaskWorkspaceMap 自定义任务关联的工作空间GUID

Functions

func GetRoutingKeyByTopic

func GetRoutingKeyByTopic(topicName string) string

func GetServerTaskAMPQServer

func GetServerTaskAMPQServer(topicName string) *machinery.Server

GetServerTaskAMPQServer 根据server配置文件,获取到消息中心的连接

func GetTopicByMQRoutingKey

func GetTopicByMQRoutingKey(routingKey string) string

func GetTopicByTaskName

func GetTopicByTaskName(taskName string, workspaceGUID string) string

func GetWorkerAMPQServer

func GetWorkerAMPQServer(topicName string, prefetchCount int) *machinery.Server

GetWorkerAMPQServer 根据worker配置文件,获取到消息中心的连接

Types

type TaskResult

type TaskResult struct {
	Status string `json:"status"`
	Msg    string `json:"msg"`
}

type WorkerRunTaskMode

type WorkerRunTaskMode int
const (
	TaskModeDefault WorkerRunTaskMode = iota
	TaskModeActive
	TaskModeFinger
	TaskModePassive
	TaskModePocscan
	TaskModeCustom
)

type WorkerStatus

type WorkerStatus struct {
	sync.Mutex `json:"-"`
	// worker's task status
	WorkerName         string    `json:"worker_name"`
	WorkerTopics       string    `json:"worker_topic"`
	CreateTime         time.Time `json:"create_time"`
	UpdateTime         time.Time `json:"update_time"`
	TaskExecutedNumber int       `json:"task_number"`
	TaskStartedNumber  int       `json:"started_number"`
	// worker's run status
	ManualReloadFlag       bool   `json:"manual_reload_flag"`
	ManualFileSyncFlag     bool   `json:"manual_file_sync_flag"`
	ManualUpdateOptionFlag bool   `json:"manual_update_daemon_option"`
	CPULoad                string `json:"cpu_load"`
	MemUsed                string `json:"mem_used"`
	// worker's option
	WorkerRunOption    []byte `json:"worker_run_option"`    //worker当前运行的启动参数
	WorkerUpdateOption []byte `json:"worker_update_option"` //worker需要更新的启动参数
	// daemon option
	IsDaemonProcess        bool      `json:"is_daemon_process"`
	WorkerDaemonUpdateTime time.Time `json:"worker_daemon_update_time"`
}

Jump to

Keyboard shortcuts

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