queue

package
v0.1.15 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(payload interface{}) error

Dispatch payload to queue

func DispatchAfter

func DispatchAfter(payload interface{}, delay time.Duration) error

DispatchAfter, display payload to queue, handle after delay

func DispatchOn

func DispatchOn(payload interface{}, on string) error

DispatchOn display payload to queue connection

func DispatchOnAfter added in v0.1.0

func DispatchOnAfter(payload interface{}, on string, delay time.Duration) error

DispatchOnAfter display payload to queue connection, handle after delay

func RegisterDriver

func RegisterDriver(name string, dr DriverRegister)

func RegisterHandler

func RegisterHandler(fn interface{}) error

RegisterHandler register queue job handler, automaticly listen job fn is job handler func, first parameter suppose to be queue job payload, support parameter injection

func WithDefaults

func WithDefaults()

Types

type ConConf

type ConConf struct {
	Driver string    `yaml:"driver"`
	Config yaml.Node `yaml:"config"`
}

type Config

type Config struct {
	Listening      bool                    `yaml:"listen" env:"QUEUE_LISTEN" default:"true"`
	Connection     string                  `yaml:"connection" env:"QUEUE_CONNECTION" default:"mem"`
	RunningWorkers []string                `yaml:"running_workers"`
	Workers        map[string]WorkerConfig `yaml:"workers"`
	Connections    map[string]ConConf      `yaml:"connections"`
}

type DriverRegister

type DriverRegister func(config yaml.Node) (c.Connection, error)

func GetDriverRegister

func GetDriverRegister(name string) (DriverRegister, bool)

type NsqConfig

type NsqConfig struct {
	Nsqd       string `yaml:"nsqd" env:"QUEUE_NSQD"`
	Nsqlookupd string `yaml:"nsqlookupd" env:"QUEUE_NSQLOOKUPD"`
	Channel    string `yaml:"channel" default:"default"`
	Topic      string `yaml:"topic" default:"default"`
}

type RedisConfig added in v0.1.2

type RedisConfig struct {
	Connection string `yaml:"connection" default:"queue"`
	Queue      string `yaml:"queue" default:"enorith:queue"`
}

type Service

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

func NewService

func NewService() *Service

func (*Service) Register

func (s *Service) Register(app *framework.App) error

Register service when app starting, before http server start you can configure service, prepare global vars etc. running at main goroutine

type WorkerConfig

type WorkerConfig struct {
	Connection  string `yaml:"connection"`
	Concurrency int    `yaml:"concurrency"`
}

Jump to

Keyboard shortcuts

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