Documentation
¶
Index ¶
Constants ¶
View Source
const ( MessageTypeLocal = iota MessageTypeRemote )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher interface {
Error() error
Publish(topic string, message Message)
Subscribe(topic string, fn HandlerFunc)
}
Dispatcher manages the communication between services.
type HandlerFunc ¶
HandlerFunc is a function that handles a message and returns nil if the message was handled successfully or an error if there was an issue handling the message.
type Message ¶
type Message struct {
Data []byte
Type MessageType
}
Message represents a message that can be sent or received. It contains the data and type of the message which can be internal or external.
Internal messages are used for communication within the same service. External messages are used for communication between different services.
func NewMessage ¶
func NewMessage(data []byte, messageType MessageType) Message
NewMessage creates a new message with the given data and type.
Click to show internal directories.
Click to hide internal directories.