diff --git a/protocol/mqtt_paho/v2/protocol.go b/protocol/mqtt_paho/v2/protocol.go index 0be53c8b..261fc6c3 100644 --- a/protocol/mqtt_paho/v2/protocol.go +++ b/protocol/mqtt_paho/v2/protocol.go @@ -90,7 +90,6 @@ func (p *Protocol) Send(ctx context.Context, m binding.Message, transformers ... defer m.Finish(err) msg := p.publishOption - msg.Properties.User = make(paho.UserProperties, 0) if cecontext.TopicFrom(ctx) != "" { msg.Topic = cecontext.TopicFrom(ctx) cecontext.WithTopic(ctx, "") diff --git a/protocol/mqtt_paho/v2/write_message.go b/protocol/mqtt_paho/v2/write_message.go index 7c925502..a4b87f4a 100644 --- a/protocol/mqtt_paho/v2/write_message.go +++ b/protocol/mqtt_paho/v2/write_message.go @@ -58,10 +58,10 @@ func (b *pubMessageWriter) SetStructuredEvent(ctx context.Context, f format.Form func (b *pubMessageWriter) Start(ctx context.Context) error { if b.Properties == nil { - b.Properties = &paho.PublishProperties{ - User: make([]paho.UserProperty, 0), - } + b.Properties = &paho.PublishProperties{} } + // the UserProperties of publish message is used to load event extensions + b.Properties.User = make([]paho.UserProperty, 0) return nil }