job

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PriorityHigh high
	PriorityHigh = uint8(8)
	// PriorityNormal normal
	PriorityNormal = uint8(4)
	// PriorityLow low
	PriorityLow = uint8(1)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func([]byte) error

Handler handler

type Message

type Message struct {
	Type     string
	ID       string
	Body     []byte
	Priority uint8
	Created  time.Time
}

Message message

func NewMessage

func NewMessage(p uint8, t string, v interface{}) (*Message, error)

NewMessage new message

func (*Message) Parse

func (p *Message) Parse(v interface{}) error

Parse parse

type Queue

type Queue interface {
	Receive(n string, f func(*Message) error) error
	Send(m *Message) error
}

Queue queue

type Server

type Server struct {
	Queue Queue `inject:""`
	// contains filtered or unexported fields
}

Server server

func New

func New() *Server

New new server

func (*Server) Do

func (p *Server) Do(name string) error

Do do

func (*Server) Register

func (p *Server) Register(t string, f Handler)

Register register job

func (*Server) Send

func (p *Server) Send(prv uint8, typ string, val interface{}) error

Send send message

func (*Server) Status

func (p *Server) Status() map[string]string

Status status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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