From 20c5840f4745f2803831994b8fd7fd9cd31cb010 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 16 Dec 2021 15:34:28 +0300 Subject: [PATCH] fix for latest micro Signed-off-by: Vasiliy Tolstov --- go.mod | 2 +- go.sum | 4 ++-- message.go | 12 ++++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index bc7eef2..3c66f4d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module go.unistack.org/micro-client-grpc/v3 go 1.16 require ( - go.unistack.org/micro/v3 v3.8.11 + go.unistack.org/micro/v3 v3.8.12 golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect google.golang.org/genproto v0.0.0-20210729151513-df9385d47c1b // indirect google.golang.org/grpc v1.42.0 diff --git a/go.sum b/go.sum index 048756b..4b8a1fd 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA= go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8= -go.unistack.org/micro/v3 v3.8.11 h1:Wv1YopcYNcsN3bW8Mv8v6AF99s0uKBtWQ1M/Ag8QLec= -go.unistack.org/micro/v3 v3.8.11/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= +go.unistack.org/micro/v3 v3.8.12 h1:ACaHE8ZIHFXqEGPSRvXzND4hcqCSQf04WkzOFY6Y1gQ= +go.unistack.org/micro/v3 v3.8.12/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/message.go b/message.go index 9f0e43b..f511f46 100644 --- a/message.go +++ b/message.go @@ -2,19 +2,18 @@ package grpc import ( "go.unistack.org/micro/v3/client" + "go.unistack.org/micro/v3/metadata" ) type grpcEvent struct { payload interface{} topic string contentType string + opts client.MessageOptions } func newGRPCEvent(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message { - var options client.MessageOptions - for _, o := range opts { - o(&options) - } + options := client.NewMessageOptions(opts...) if len(options.ContentType) > 0 { contentType = options.ContentType @@ -24,6 +23,7 @@ func newGRPCEvent(topic string, payload interface{}, contentType string, opts .. payload: payload, topic: topic, contentType: contentType, + opts: options, } } @@ -38,3 +38,7 @@ func (g *grpcEvent) Topic() string { func (g *grpcEvent) Payload() interface{} { return g.payload } + +func (g *grpcEvent) Metadata() metadata.Metadata { + return g.opts.Metadata +}