micro-client-drpc/message.go
Vasiliy Tolstov 80842ca667 fix for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-12-16 15:27:02 +03:00

45 lines
857 B
Go

package drpc
import (
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/metadata"
)
type drpcEvent struct {
payload interface{}
topic string
contentType string
opts client.MessageOptions
}
func newDRPCEvent(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
options := client.NewMessageOptions(opts...)
if len(options.ContentType) > 0 {
contentType = options.ContentType
}
return &drpcEvent{
payload: payload,
topic: topic,
opts: options,
contentType: contentType,
}
}
func (d *drpcEvent) ContentType() string {
return d.contentType
}
func (d *drpcEvent) Topic() string {
return d.topic
}
func (d *drpcEvent) Payload() interface{} {
return d.payload
}
func (d *drpcEvent) Metadata() metadata.Metadata {
return d.opts.Metadata
}