Decruft the broker by removing Event interface (#1940)

This commit is contained in:
Asim Aslam
2020-08-18 14:00:51 +01:00
committed by GitHub
parent a2a808f2d6
commit 4413372a3f
14 changed files with 45 additions and 226 deletions

View File

@@ -16,21 +16,15 @@ type Broker interface {
// Handler is used to process messages via a subscription of a topic.
// The handler is passed a publication interface which contains the
// message and optional Ack method to acknowledge receipt of the message.
type Handler func(Event) error
type Handler func(*Message) error
type ErrorHandler func(*Message, error)
type Message struct {
Header map[string]string
Body []byte
}
// Event is given to a subscription handler for processing
type Event interface {
Topic() string
Message() *Message
Ack() error
Error() error
}
// Subscriber is a convenience return type for the Subscribe method
type Subscriber interface {
Options() SubscribeOptions