2020-09-03 12:21:00 +03:00
|
|
|
package tcp
|
|
|
|
|
2020-11-18 13:02:53 +03:00
|
|
|
import (
|
2021-10-27 01:04:58 +03:00
|
|
|
"go.unistack.org/micro/v3/codec"
|
|
|
|
"go.unistack.org/micro/v3/metadata"
|
|
|
|
"go.unistack.org/micro/v3/server"
|
2020-11-18 13:02:53 +03:00
|
|
|
)
|
2020-09-03 12:21:00 +03:00
|
|
|
|
2021-04-26 01:10:37 +03:00
|
|
|
var _ server.Message = &tcpMessage{}
|
|
|
|
|
2020-09-03 12:21:00 +03:00
|
|
|
type tcpMessage struct {
|
|
|
|
payload interface{}
|
2021-04-26 01:10:37 +03:00
|
|
|
codec codec.Codec
|
2020-11-18 13:02:53 +03:00
|
|
|
header metadata.Metadata
|
2021-04-26 01:10:37 +03:00
|
|
|
topic string
|
|
|
|
contentType string
|
2020-09-03 12:21:00 +03:00
|
|
|
body []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *tcpMessage) Topic() string {
|
|
|
|
return r.topic
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *tcpMessage) ContentType() string {
|
|
|
|
return r.contentType
|
|
|
|
}
|
|
|
|
|
2020-11-18 13:02:53 +03:00
|
|
|
func (r *tcpMessage) Header() metadata.Metadata {
|
2020-09-03 12:21:00 +03:00
|
|
|
return r.header
|
|
|
|
}
|
|
|
|
|
2022-03-21 15:30:19 +03:00
|
|
|
func (r *tcpMessage) Body() interface{} {
|
|
|
|
return r.payload
|
2020-09-03 12:21:00 +03:00
|
|
|
}
|
|
|
|
|
2020-11-25 23:56:38 +03:00
|
|
|
func (r *tcpMessage) Codec() codec.Codec {
|
2020-09-03 12:21:00 +03:00
|
|
|
return r.codec
|
|
|
|
}
|