Change Publication to Event

This commit is contained in:
Asim Aslam 2019-07-07 12:44:09 +01:00 committed by Vasiliy Tolstov
parent 9235dfb2a2
commit 1b9e535220
2 changed files with 8 additions and 8 deletions

View File

@ -295,7 +295,7 @@ func (g *grpcClient) Options() client.Options {
}
func (g *grpcClient) NewMessage(topic string, msg interface{}, opts ...client.MessageOption) client.Message {
return newGRPCPublication(topic, msg, g.opts.ContentType, opts...)
return newGRPCEvent(topic, msg, g.opts.ContentType, opts...)
}
func (g *grpcClient) NewRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request {
@ -498,7 +498,7 @@ func (g *grpcClient) Publish(ctx context.Context, p client.Message, opts ...clie
}
b := &buffer{bytes.NewBuffer(nil)}
if err := cf(b).Write(&codec.Message{Type: codec.Publication}, p.Payload()); err != nil {
if err := cf(b).Write(&codec.Message{Type: codec.Event}, p.Payload()); err != nil {
return errors.InternalServerError("go.micro.client", err.Error())
}

View File

@ -4,13 +4,13 @@ import (
"github.com/micro/go-micro/client"
)
type grpcPublication struct {
type grpcEvent struct {
topic string
contentType string
payload interface{}
}
func newGRPCPublication(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
func newGRPCEvent(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
var options client.MessageOptions
for _, o := range opts {
o(&options)
@ -20,21 +20,21 @@ func newGRPCPublication(topic string, payload interface{}, contentType string, o
contentType = options.ContentType
}
return &grpcPublication{
return &grpcEvent{
payload: payload,
topic: topic,
contentType: contentType,
}
}
func (g *grpcPublication) ContentType() string {
func (g *grpcEvent) ContentType() string {
return g.contentType
}
func (g *grpcPublication) Topic() string {
func (g *grpcEvent) Topic() string {
return g.topic
}
func (g *grpcPublication) Payload() interface{} {
func (g *grpcEvent) Payload() interface{} {
return g.payload
}