Add configurable codecs for broker/transport

This commit is contained in:
Asim Aslam
2016-12-06 18:37:35 +00:00
parent e10259940b
commit bd3c798fd9
6 changed files with 100 additions and 3 deletions

View File

@@ -31,12 +31,22 @@ type Publication interface {
Ack() error
}
// Subscriber is a convenience return type for the Subscribe method
type Subscriber interface {
Options() SubscribeOptions
Topic() string
Unsubscribe() error
}
// Codec is used for encoding where the broker doesn't natively support
// headers in the message type. In this case the entire message is
// encoded as the payload
type Codec interface {
Marshal(interface{}) ([]byte, error)
Unmarshal([]byte, interface{}) error
String() string
}
var (
DefaultBroker Broker = newHttpBroker()
)