Documentation ¶
Index ¶
- func BindProcessorHandler(peer cellnetEx.Peer, procName string, userCallback cellnetEx.EventCallback, ...)
- func NewMultiHooker(h ...cellnetEx.EventHooker) cellnetEx.EventHooker
- func NewQueuedEventCallback(callback cellnetEx.EventCallback) cellnetEx.EventCallback
- func ProcessorList() (ret []string)
- func RegisterProcessor(procName string, f ProcessorBinder)
- type MessageDispatcher
- type MultiHooker
- type ProcessorBinder
- type ProcessorBundle
- type SyncReceiver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindProcessorHandler ¶
func BindProcessorHandler(peer cellnetEx.Peer, procName string, userCallback cellnetEx.EventCallback, args ...interface{})
绑定固定回调处理器, procName来源于RegisterProcessor注册的处理器,形如: 'tcp.ltv'
func NewMultiHooker ¶
func NewMultiHooker(h ...cellnetEx.EventHooker) cellnetEx.EventHooker
func NewQueuedEventCallback ¶
func NewQueuedEventCallback(callback cellnetEx.EventCallback) cellnetEx.EventCallback
让EventCallback保证放在ses的队列里,而不是并发的
func RegisterProcessor ¶
func RegisterProcessor(procName string, f ProcessorBinder)
注册事件处理器,内部及自定义收发流程时使用
Types ¶
type MessageDispatcher ¶
type MessageDispatcher struct {
// contains filtered or unexported fields
}
消息派发器,可选件,兼容v3以前的注册及派发消息方式,在没有代码生成框架及工具时是较方便的接收处理接口
func NewMessageDispatcher ¶
func NewMessageDispatcher() *MessageDispatcher
func NewMessageDispatcherBindPeer ¶
func NewMessageDispatcherBindPeer(peer cellnetEx.Peer, processorName string) *MessageDispatcher
func (*MessageDispatcher) Exists ¶
func (self *MessageDispatcher) Exists(msgName string) bool
func (*MessageDispatcher) OnEvent ¶
func (self *MessageDispatcher) OnEvent(ev cellnetEx.Event)
func (*MessageDispatcher) RegisterMessage ¶
func (self *MessageDispatcher) RegisterMessage(msgName string, userCallback cellnetEx.EventCallback)
type MultiHooker ¶
type MultiHooker []cellnetEx.EventHooker
当需要多个Hooker时,使用NewMultiHooker将多个hooker合并成1个hooker处理
func (MultiHooker) OnInboundEvent ¶
func (self MultiHooker) OnInboundEvent(input cellnetEx.Event) (output cellnetEx.Event)
func (MultiHooker) OnOutboundEvent ¶
func (self MultiHooker) OnOutboundEvent(input cellnetEx.Event) (output cellnetEx.Event)
type ProcessorBinder ¶
type ProcessorBinder func(bundle ProcessorBundle, userCallback cellnetEx.EventCallback, args ...interface{})
type ProcessorBundle ¶
type ProcessorBundle interface { // 设置 传输器,负责收发消息 SetTransmitter(v cellnetEx.MessageTransmitter) // 设置 接收后,发送前的事件处理流程 SetHooker(v cellnetEx.EventHooker) // 设置 接收后最终处理回调 SetCallback(v cellnetEx.EventCallback) }
处理器设置接口,由各Peer实现
type SyncReceiver ¶
type SyncReceiver struct {
// contains filtered or unexported fields
}
同步接收消息器, 可选件,可作为流程测试辅助工具
func NewSyncReceiver ¶
func NewSyncReceiver(p cellnetEx.Peer) *SyncReceiver
func (*SyncReceiver) EventCallback ¶
func (self *SyncReceiver) EventCallback() cellnetEx.EventCallback
将处理回调返回给BindProcessorHandler用于注册
func (*SyncReceiver) Recv ¶
func (self *SyncReceiver) Recv(callback cellnetEx.EventCallback) *SyncReceiver
持续阻塞,直到某个消息到达后,使用回调返回消息
func (*SyncReceiver) WaitMessage ¶
func (self *SyncReceiver) WaitMessage(msgName string) (msg interface{})
持续阻塞,直到某个消息到达后,返回消息
Click to show internal directories.
Click to hide internal directories.