messagehandle

package
Version: v0.0.0-...-179649a Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessageHandle

func NewMessageHandle() ziface.IMessageHandle

初始化

Types

type MessageHandle

type MessageHandle struct {
	//负责 Worker 去任务的消息队列
	TaskQueue []chan ziface.IRequest

	//业务工作 Worker 池的数量
	WorkerPoolSize uint32

	//存放每个 msgId 对应的处理方法
	Routers map[uint32]ziface.IRouter
}

*

* 消息处理模块的实现

func (*MessageHandle) AddRouter

func (m *MessageHandle) AddRouter(msgId uint32, router ziface.IRouter) error

消息添加路由关系

func (*MessageHandle) DoMsgHandler

func (m *MessageHandle) DoMsgHandler(request ziface.IRequest) error

调度 执行对应的 router 消息处理方法

func (*MessageHandle) SendMsgToTaskQueue

func (m *MessageHandle) SendMsgToTaskQueue(request ziface.IRequest)

将消息交给 taskQueue, 由 worker 进行处理

func (*MessageHandle) StartWorkerPool

func (m *MessageHandle) StartWorkerPool()

启动 worker 工作池,

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL