Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidState = errors.New("bus: invalid state") ErrInvalidConnection = errors.New("bus: invalid connection") ErrInvalidTransport = errors.New("bus: invalid transport") ErrConnectionFailed = errors.New("bus: connection failed") )
Errors
Functions ¶
func ConnectAndServe ¶
func ConnectAndServe(ctx context.Context, conn Connection, tran Transport) error
ConnectAndServe starts bus
Types ¶
type Connection ¶
type Connection interface { // Connect to broker Connect() error // Disconnect from broker Disconnect() // IsConnected status IsConnected() bool // Status of connection Status() <-chan struct{} }
Connection interface
type MessageHandler ¶
type MessageHandler interface { // Handle message Handle([]byte) }
MessageHandler interface
type Subscription ¶
type Subscription interface { // Unsubscribe subscription Unsubscribe() error }
Subscription unsubscribe existing subscription
func Subscribe ¶
func Subscribe(topic string, handler MessageHandler) Subscription
Subscribe for messages
func SubscribeQueue ¶
func SubscribeQueue(topic string, queue string, handler MessageHandler) Subscription
SubscribeQueue for messages
type Transport ¶
type Transport interface { // Publish message Publish(topic string, message []byte) error // Subscribe for messages Subscribe(topic string, queue string, handler MessageHandler) (interface{}, error) // Unsubscribe subscription Unsubscribe(handle interface{}) error }
Transport interface
Click to show internal directories.
Click to hide internal directories.