task

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultQueueSize      = 1024
	DefaultDbScanInterval = 10
)

Variables

This section is empty.

Functions

func AfterHandleTask

func AfterHandleTask(task model.MessageTask, message model.MessageInfo, err error)

func InitMonitor

func InitMonitor(ctx context.Context)

func RunClearExpired

func RunClearExpired(ctx context.Context)

Types

type MessageTask

type MessageTask interface {
	Run()
	HandleMessage(message model.MessageInfo) (err error)
}

func New

func New(ctx context.Context, executor sender.TaskExecutor, opts ...Option) (t MessageTask, err error)

type MonitorData

type MonitorData struct {
	TaskId            int                 `json:"taskId,omitempty"`
	MessageId         int                 `json:"messageId,omitempty"`
	MessageCategory   msg.MessageCategory `json:"messageCategory,omitempty"`
	Subject           string              `json:"subject,omitempty"`
	MessageInstanceId int                 `json:"messageInstanceId,omitempty"`
	Status            int                 `json:"status,omitempty"`
}

type Option added in v0.10.2

type Option func(task *messageTask)

func WithDb added in v0.10.2

func WithDb(scanInternal int) Option

func WithQueue added in v0.10.2

func WithQueue(queueSize int) Option

type SendMonitor

type SendMonitor interface {
	Subscribe(c *websocket.Conn)
	UnSubscribe(c *websocket.Conn)
	Pub(msg MonitorData)
}

func GetMonitor

func GetMonitor() SendMonitor

type Strategy added in v0.10.2

type Strategy int
const (
	MemQueue Strategy = iota
	Db
)

Jump to

Keyboard shortcuts

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