1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-10 21:52:01 +02:00

add message options

This commit is contained in:
Asim Aslam
2018-05-10 17:33:54 +01:00
parent b39ec4472c
commit c3c0543733
4 changed files with 24 additions and 8 deletions

View File

@@ -6,7 +6,16 @@ type message struct {
payload interface{}
}
func newMessage(topic string, payload interface{}, contentType string) Message {
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
}
return &message{
payload: payload,
topic: topic,