busworker

package
v0.0.0-...-aa68dce Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecSuccess  = 200
	ExecFail     = 500
	ExecNotFound = 404
)
View Source
const (
	DefaultTimeout = time.Second * 3600
)

Variables

View Source
var HttpRouter = make(map[string]http.HandlerFunc)
View Source
var Router = make(map[string]*WorkerRouter)

Functions

func GetRouter

func GetRouter() map[string]*WorkerRouter

func NotFound

func NotFound(w http.ResponseWriter, r *http.Request)

func RegisterHttpHandler

func RegisterHttpHandler(pattern string, handlerFunc http.HandlerFunc)

func Serve

func Serve(address string)

Types

type Client

type Client struct {
	*msgRedis.MultiPool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(addr string) *Client

redis address string format ip:port:password

func (*Client) AddJobs

func (c *Client) AddJobs(queue string, password string, contents ...interface{}) error

add jobs to specified queue

func (*Client) Auth

func (c *Client) Auth(queue string, password string) error

type Resp

type Resp struct {
	ErrorCode int         `json:"error_code"`
	Code      int         `json:"code"`
	Data      interface{} `json:"data"`
}

resp define response data

type WorkerHandler

type WorkerHandler func(r *http.Request) *Resp

type WorkerRouter

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

func NewWorkerRouter

func NewWorkerRouter(pattern string) *WorkerRouter

func (*WorkerRouter) RegisterJobHandler

func (wr *WorkerRouter) RegisterJobHandler(queueName, topicName string, handlerFunc WorkerHandler)

type WorkerServer

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

Jump to

Keyboard shortcuts

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