handler

package
v0.0.0-...-7cd6839 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Error = log.New(os.Stderr, "ERROR ", log.Lshortfile|log.LstdFlags)
	Debug = log.New(os.Stderr, "DEBUG ", log.Lshortfile|log.LstdFlags)

	NewReaderHandler *ReaderHandler
)

Functions

This section is empty.

Types

type JsonRequest

type JsonRequest struct {
	sync.RWMutex
	Typ       uint16 //消息类型
	Id        uint64 //用户id
	RouteName string //来源路由服务器 -回写使用
	// contains filtered or unexported fields
}

用来预处理nsq 发过来的数据

func (*JsonRequest) BaseByte

func (self *JsonRequest) BaseByte() []byte

func (*JsonRequest) Byte

func (self *JsonRequest) Byte() []byte

func (JsonRequest) Copy

func (self JsonRequest) Copy() RequestByNsq

func (*JsonRequest) GetId

func (self *JsonRequest) GetId() uint64

func (*JsonRequest) GetRoute

func (self *JsonRequest) GetRoute() string

func (*JsonRequest) Marshal

func (self *JsonRequest) Marshal(data interface{}) (err error)

func (*JsonRequest) Reset

func (self *JsonRequest) Reset()

func (*JsonRequest) SetId

func (self *JsonRequest) SetId(id uint64)

func (*JsonRequest) SetRoute

func (self *JsonRequest) SetRoute(name string)

func (*JsonRequest) SetType

func (self *JsonRequest) SetType(id uint16)

func (*JsonRequest) Type

func (self *JsonRequest) Type() uint16

func (*JsonRequest) Unmarshal

func (self *JsonRequest) Unmarshal(info interface{}) error

func (*JsonRequest) UnmarshalData

func (self *JsonRequest) UnmarshalData(data []byte) (err error)

type JsonResponseWrite

type JsonResponseWrite struct {
	RouteName string
	Producer  *nsq.Producer
	Id        uint64
}

func (*JsonResponseWrite) Close

func (self *JsonResponseWrite) Close() (err error)

* 重点用在nsq 向route 发送数据时。

func (*JsonResponseWrite) Write

func (self *JsonResponseWrite) Write(body []byte) (err error)

type NsqReaderHandler

type NsqReaderHandler struct {
	Producer *nsq.Producer
	// contains filtered or unexported fields
}

func (*NsqReaderHandler) HandleMessage

func (self *NsqReaderHandler) HandleMessage(message *nsq.Message) error

type ReaderHandler

type ReaderHandler struct {
	Consumer *nsq.Consumer
	Producer *nsq.Producer
	// contains filtered or unexported fields
}

func (*ReaderHandler) Run

func (self *ReaderHandler) Run(conf *Configure) error

func (*ReaderHandler) Stop

func (self *ReaderHandler) Stop()

Jump to

Keyboard shortcuts

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