You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/01/23 11:16:26 UTC

[GitHub] [rocketmq] duhenglucky commented on a change in pull request #2598: [ISSUE #2556] Lite pull consumer support message trace

duhenglucky commented on a change in pull request #2598:
URL: https://github.com/apache/rocketmq/pull/2598#discussion_r563108564



##########
File path: client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java
##########
@@ -158,6 +163,33 @@ public Thread newThread(Runnable r) {
         this.pullTimeDelayMillsWhenException = defaultLitePullConsumer.getPullTimeDelayMillsWhenException();
     }
 
+    public void registerConsumeMessageHook(final ConsumeMessageHook hook) {
+        this.consumeMessageHookList.add(hook);
+        log.info("register consumeMessageHook Hook, {}", hook.hookName());
+    }
+
+    public void executeHookBefore(final ConsumeMessageContext context) {
+        if (!this.consumeMessageHookList.isEmpty()) {
+            for (ConsumeMessageHook hook : this.consumeMessageHookList) {
+                try {
+                    hook.consumeMessageBefore(context);
+                } catch (Throwable e) {

Review comment:
       Swallowing exceptions is not a good practice

##########
File path: client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageTraceHookImpl.java
##########
@@ -60,7 +60,6 @@ public void sendMessageBefore(SendMessageContext context) {
         traceBean.setStoreHost(context.getBrokerAddr());
         traceBean.setBodyLength(context.getMessage().getBody().length);
         traceBean.setMsgType(context.getMsgType());
-        traceBean.setClientHost(((AsyncTraceDispatcher)localDispatcher).getHostProducer().getmQClientFactory().getClientId());

Review comment:
       why remove this  clienthost?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org