You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2020/12/31 02:36:43 UTC

[rocketmq-client-go] branch cgo updated: [ISSUE #576] Fix get message property failed after it is set to go msg struct. (#577)

This is an automated email from the ASF dual-hosted git repository.

dinglei pushed a commit to branch cgo
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git


The following commit(s) were added to refs/heads/cgo by this push:
     new 35a8b6e  [ISSUE #576] Fix get message property failed after it is set to go msg struct. (#577)
35a8b6e is described below

commit 35a8b6e892cf52b5d4a5d65df1c93844c617f076
Author: dinglei <li...@163.com>
AuthorDate: Thu Dec 31 10:36:36 2020 +0800

    [ISSUE #576] Fix get message property failed after it is set to go msg struct. (#577)
---
 core/message.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/core/message.go b/core/message.go
index 83db646..12d8abc 100644
--- a/core/message.go
+++ b/core/message.go
@@ -47,6 +47,12 @@ func (msg *Message) String() string {
 
 //GetProperty get message property by key string
 func (msg *Message) GetProperty(key string) string {
+	if msg.Property != nil {
+		v, ok := msg.Property["key"]
+		if ok {
+			return v
+		}
+	}
 	ck := C.CString(key)
 	defer C.free(unsafe.Pointer(ck))
 	return C.GoString(C.GetOriginMessageProperty(msg.cmsg, ck))