Change initialisation and add metadata
This commit is contained in:
@@ -165,7 +165,7 @@ func (h *httpBroker) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx := c.WithMetaData(context.Background(), e.Header)
|
||||
ctx := c.WithMetadata(context.Background(), e.Header)
|
||||
|
||||
h.RLock()
|
||||
for _, subscriber := range h.subscribers[e.Message.Topic] {
|
||||
@@ -208,7 +208,7 @@ func (h *httpBroker) Publish(ctx context.Context, topic string, body []byte) err
|
||||
Body: body,
|
||||
}
|
||||
|
||||
header, _ := c.GetMetaData(ctx)
|
||||
header, _ := c.GetMetadata(ctx)
|
||||
|
||||
b, err := json.Marshal(&envelope{
|
||||
header,
|
||||
|
@@ -68,7 +68,7 @@ func (n *nbroker) Init() error {
|
||||
}
|
||||
|
||||
func (n *nbroker) Publish(ctx context.Context, topic string, body []byte) error {
|
||||
header, _ := c.GetMetaData(ctx)
|
||||
header, _ := c.GetMetadata(ctx)
|
||||
|
||||
message := &broker.Message{
|
||||
Id: uuid.NewUUID().String(),
|
||||
@@ -93,7 +93,7 @@ func (n *nbroker) Subscribe(topic string, function func(context.Context, *broker
|
||||
if err := json.Unmarshal(msg.Data, &e); err != nil {
|
||||
return
|
||||
}
|
||||
ctx := c.WithMetaData(context.Background(), e.Header)
|
||||
ctx := c.WithMetadata(context.Background(), e.Header)
|
||||
function(ctx, e.Message)
|
||||
})
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user