mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
f23638c036
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
41 lines
719 B
Go
41 lines
719 B
Go
package grpc
|
|
|
|
import (
|
|
"github.com/micro/go-micro/v2/client"
|
|
)
|
|
|
|
type grpcEvent struct {
|
|
topic string
|
|
contentType string
|
|
payload interface{}
|
|
}
|
|
|
|
func newGRPCEvent(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
|
|
var options client.MessageOptions
|
|
for _, o := range opts {
|
|
o(&options)
|
|
}
|
|
|
|
if len(options.ContentType) > 0 {
|
|
contentType = options.ContentType
|
|
}
|
|
|
|
return &grpcEvent{
|
|
payload: payload,
|
|
topic: topic,
|
|
contentType: contentType,
|
|
}
|
|
}
|
|
|
|
func (g *grpcEvent) ContentType() string {
|
|
return g.contentType
|
|
}
|
|
|
|
func (g *grpcEvent) Topic() string {
|
|
return g.topic
|
|
}
|
|
|
|
func (g *grpcEvent) Payload() interface{} {
|
|
return g.payload
|
|
}
|