localworker

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTypeKey = "msg-type"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Msg

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

func NewMsg

func NewMsg(id uint64, headers map[string]string, body string) *Msg

func (*Msg) Body

func (m *Msg) Body() string

func (*Msg) Headers

func (m *Msg) Headers() map[string]string

func (*Msg) ID

func (m *Msg) ID() uint64

type WorkerPool

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

func NewWorkerPool

func NewWorkerPool(queueSize, sleep, workerCount int, logger *zap.SugaredLogger) *WorkerPool

func (*WorkerPool) AddHandler

func (wp *WorkerPool) AddHandler(msgType string, handler worker.MsgHandler)

func (*WorkerPool) DelHandler

func (wp *WorkerPool) DelHandler(msgType string)

func (*WorkerPool) QueueLen added in v0.6.1

func (wp *WorkerPool) QueueLen() int

func (*WorkerPool) Start

func (wp *WorkerPool) Start()

func (*WorkerPool) Stop

func (wp *WorkerPool) Stop()

func (*WorkerPool) TryPut

func (wp *WorkerPool) TryPut(task worker.IMsg) error

Jump to

Keyboard shortcuts

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