Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultAddress default redis address when no address is passed
DefaultAddress = "tcp://127.0.0.1:6379"
)
Variables ¶
View Source
var ( // ErrFunctionNotFound is an err returned if the handler function is not found ErrFunctionNotFound = fmt.Errorf("function not found") )
Functions ¶
Types ¶
type Client ¶
type Client interface {
Call(ctx context.Context, twin uint32, fn string, data interface{}, result interface{}) error
}
Client is an rmb abstract client interface.
type Message ¶
type Message struct {
Version int `json:"ver"`
UID string `json:"uid"`
Command string `json:"cmd"`
Expiration int `json:"exp"`
Retry int `json:"try"`
Data string `json:"dat"`
TwinSrc uint32 `json:"src"`
TwinDest []uint32 `json:"dst"`
Retqueue string `json:"ret"`
Schema string `json:"shm"`
Epoch int64 `json:"now"`
Err string `json:"err"`
// Proxy flag is only used to keep the value sent by
// msgbusd. because it need to be send back as is to
// the daemon. While it's not used in the client side
// it need to stay
Proxy bool `json:"pxy"`
}
Message is an struct used to communicate over the messagebus
func GetMessage ¶
GetMessage gets a message from the context, panics if it's not there
func (*Message) GetPayload ¶
GetPayload returns the payload for a message's data
type MessageBus ¶
type MessageBus struct {
// contains filtered or unexported fields
}
MessageBus is a struct that contains everything required to run the message bus
func (*MessageBus) Handlers ¶
func (m *MessageBus) Handlers() []string
Handlers return full name of all registered handlers
func (*MessageBus) Run ¶
func (m *MessageBus) Run(ctx context.Context) error
Run runs listeners to the configured handlers and will trigger the handlers in the case an event comes in
func (*MessageBus) Use ¶
func (m *MessageBus) Use(mw Middleware)
func (*MessageBus) WithHandler ¶
WithHandler adds a topic handler to the messagebus
type Middleware ¶
Middleware is middleware function type
Click to show internal directories.
Click to hide internal directories.