1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-23 17:53:05 +02:00
go-micro/client/rpc_message.go

37 lines
637 B
Go
Raw Normal View History

2018-04-14 18:06:52 +01:00
package client
type message struct {
2023-04-26 00:16:34 +00:00
payload interface{}
2018-04-14 18:06:52 +01:00
topic string
contentType string
}
2018-05-10 17:33:54 +01:00
func newMessage(topic string, payload interface{}, contentType string, opts ...MessageOption) Message {
var options MessageOptions
for _, o := range opts {
o(&options)
}
if len(options.ContentType) > 0 {
contentType = options.ContentType
}
2018-04-14 18:06:52 +01:00
return &message{
payload: payload,
topic: topic,
contentType: contentType,
}
}
func (m *message) ContentType() string {
return m.contentType
}
func (m *message) Topic() string {
return m.topic
}
func (m *message) Payload() interface{} {
return m.payload
}