Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsHandlerNotFoundErr ¶ added in v0.3.0
IsHandlerNotFoundErr checks if error is HandlerNotFoundErr
Types ¶
type Broker ¶
type Broker interface {
Send(dst string, m Message) error
Publish(m Message) error
Start(handle MessageHandler) error
Stop() error
Shutdown(ctx context.Context) error
Endpoint() string
Subscribe(endpoint string, messageName string) error
}
Broker interface
type Bus ¶
type Bus interface {
StarterStopper
Sender
Publisher
Subscriber
}
Bus for publishing, sending and receiving messages
type HandlerNotFoundErr ¶ added in v0.2.2
type HandlerNotFoundErr struct {
MessageName string
}
HandlerNotFoundErr is returned when handler is not found
func (HandlerNotFoundErr) Error ¶ added in v0.2.2
func (e HandlerNotFoundErr) Error() string
type Message ¶
type Message struct {
Headers map[string]string
Body []byte
// contains filtered or unexported fields
}
Message in EzBus
func NewMessage ¶
NewMessage creates a new Message instance Using h as headers and b as body
type MessageHandler ¶
MessageHandler func for handling messsages
type Middleware ¶
type Middleware = func(next MessageHandler) MessageHandler
Middleware for router message handling pipeline
type Publisher ¶
type Publisher interface {
Publish(msg interface{}) error
PublishContext(ctx context.Context, msg interface{}) error
}
Publisher publishes a message to subscribers. PublishContext carries ctx along with the message; Publish is PublishContext with context.Background().
type Router ¶
type Router interface {
Handle(messageName string, h MessageHandler)
Middleware(mw Middleware)
Receive(n string, m Message) error
}
Router routes message to correct MessageHandler func
type Sender ¶
type Sender interface {
Send(dst string, msg interface{}) error
SendContext(ctx context.Context, dst string, msg interface{}) error
}
Sender sends a message to a destination. SendContext carries ctx along with the message; Send is SendContext with context.Background().
type StarterStopper ¶ added in v0.1.1
type StarterStopper interface {
Go() error
Run(ctx context.Context) error
Stop() error
Shutdown(ctx context.Context) error
}
StarterStopper interface. Stop and Shutdown both let the handler that is running finish: Stop within the broker's drain timeout, Shutdown until ctx ends. Run is Go, a wait for ctx to end, and Stop.
type Subscriber ¶
type Subscriber interface {
Subscribe(endpoint string)
SubscribeMessage(endpoint string, messageName string)
}
Subscriber interface