rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From duhengfore...@apache.org
Subject [rocketmq] branch develop updated: [ISSUE #1771]add MessageExt.getBrokerName for issue (#1772)
Date Fri, 14 Feb 2020 07:46:11 GMT
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new d03e46a  [ISSUE #1771]add MessageExt.getBrokerName   for issue  (#1772)
d03e46a is described below

commit d03e46a4cb0be50401a4fcd9132392a6dde43861
Author: uglycow <xieyuneng@gmail.com>
AuthorDate: Fri Feb 14 15:45:59 2020 +0800

    [ISSUE #1771]add MessageExt.getBrokerName   for issue  (#1772)
    
    * typo fix
    
    * add MessageExt.getBrokerName()
    
    * add brokerName for toString
    
    * get brokerName  from mq
---
 .../apache/rocketmq/client/impl/consumer/PullAPIWrapper.java |  1 +
 .../java/org/apache/rocketmq/common/message/MessageExt.java  | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java
b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java
index 1917d27..231ac0c 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java
@@ -104,6 +104,7 @@ public class PullAPIWrapper {
                     Long.toString(pullResult.getMinOffset()));
                 MessageAccessor.putProperty(msg, MessageConst.PROPERTY_MAX_OFFSET,
                     Long.toString(pullResult.getMaxOffset()));
+                msg.setBrokerName(mq.getBrokerName());
             }
 
             pullResultExt.setMsgFoundList(msgListFilterAgain);
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
index 20cb057..7f35172 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
@@ -27,6 +27,8 @@ import org.apache.rocketmq.common.sysflag.MessageSysFlag;
 public class MessageExt extends Message {
     private static final long serialVersionUID = 5720810158625748049L;
 
+    private String brokerName;
+
     private int queueId;
 
     private int storeSize;
@@ -107,6 +109,14 @@ public class MessageExt extends Message {
         return socketAddress2ByteBuffer(this.storeHost, byteBuffer);
     }
 
+    public String getBrokerName() {
+        return brokerName;
+    }
+
+    public void setBrokerName(String brokerName) {
+        this.brokerName = brokerName;
+    }
+
     public int getQueueId() {
         return queueId;
     }
@@ -235,7 +245,7 @@ public class MessageExt extends Message {
 
     @Override
     public String toString() {
-        return "MessageExt [queueId=" + queueId + ", storeSize=" + storeSize + ", queueOffset="
+ queueOffset
+        return "MessageExt [brokerName=" + brokerName + ", queueId=" + queueId + ", storeSize="
+ storeSize + ", queueOffset=" + queueOffset
             + ", sysFlag=" + sysFlag + ", bornTimestamp=" + bornTimestamp + ", bornHost="
+ bornHost
             + ", storeTimestamp=" + storeTimestamp + ", storeHost=" + storeHost + ", msgId="
+ msgId
             + ", commitLogOffset=" + commitLogOffset + ", bodyCRC=" + bodyCRC + ", reconsumeTimes="


Mime
View raw message