Skip to content

Commit

Permalink
add 'AddProperty' (#432)
Browse files Browse the repository at this point in the history
Co-authored-by: guyinyou <[email protected]>
  • Loading branch information
guyinyou and guyinyou committed Mar 31, 2023
1 parent 3a7adcb commit 90eecba
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion golang/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,21 @@ func (msg *Message) SetKeys(keys ...string) {
msg.keys = keys
}

func (msg *Message) GetProperties() map[string]string {
func (msg *Message) getOrNewProperties() map[string]string {
if msg.properties == nil {
msg.properties = make(map[string]string)
}
return msg.properties
}

func (msg *Message) GetProperties() map[string]string {
return msg.getOrNewProperties()
}

func (msg *Message) AddProperty(key, value string) {
msg.getOrNewProperties()[key] = value
}

func (msg *Message) SetDelayTimestamp(deliveryTimestamp time.Time) {
msg.deliveryTimestamp = &deliveryTimestamp
}
Expand Down

0 comments on commit 90eecba

Please sign in to comment.