metadata: add default headers

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-07-23 12:03:18 +03:00
parent d357fb1e0d
commit 675e121049
6 changed files with 33 additions and 13 deletions

View File

@@ -112,6 +112,13 @@ type Message struct {
Body RawMessage
}
// NewMessage create broker message with topic filled
func NewMessage(topic string) *Message {
m := &Message{Header: metadata.New(2)}
m.Header.Set(metadata.HeaderTopic, topic)
return m
}
// Subscriber is a convenience return type for the Subscribe method
type Subscriber interface {
// Options returns subscriber options