Change initialisation and add metadata

This commit is contained in:
Asim
2015-05-26 22:39:48 +01:00
parent 7aa2c82ced
commit 36b5ca46fe
16 changed files with 182 additions and 93 deletions

View File

@@ -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,

View File

@@ -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 {