Documentation ¶
Index ¶
- type MessageHandler
- type Messenger
- func (m *Messenger) Destroy() error
- func (m *Messenger) Recv() (interface{}, error)
- func (m *Messenger) RegisterHandler(msg interface{}, msgHandler MessageHandler) error
- func (m *Messenger) RegisterMessage(msg interface{}) error
- func (m *Messenger) Send(hostport string, msg interface{}) error
- func (m *Messenger) Start() error
- func (m *Messenger) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageHandler ¶
type MessageHandler func(interface{})
MessageHandler is a callback that handles the messages. One can register the message with the callback by calling RegisterHandler.
type Messenger ¶
type Messenger struct {
// contains filtered or unexported fields
}
Messenger is an abstraction that can send and receive messages.
func New ¶
func New(codec codec.Codec, tr transporter.Transporter, enableRecv, enableHandler bool) *Messenger
New create a new messenger. If enableRecv is set to true, then the user should be responsible to consume the message via Recv(), otherwise the the underlying reading will stop if the queue is full. At least one of the enableRecv and enableHandler should be set to true.
func (*Messenger) RegisterHandler ¶
func (m *Messenger) RegisterHandler(msg interface{}, msgHandler MessageHandler) error
RegisterHandler regists a message with a handler. When such a message comes in, it will be passed to the handler.
func (*Messenger) RegisterMessage ¶
RegisterMessage Regists a message in the messenger. It will call the undelying codec to register the message as well.
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/code.google.com/p/gogoprotobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
|
Package proto converts data structures to and from the wire format of protocol buffers. |
_workspace/src/github.com/golang/glog
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
|
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup. |
testexample
Package protobuf is a generated protocol buffer package.
|
Package protobuf is a generated protocol buffer package. |