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 2018/11/07 07:27:51 UTC

[GitHub] lemonzone2010 opened a new issue #531: can't get code and errorMsg in SendMessageContext when runing executeSendMessageHookAfter

lemonzone2010 opened a new issue #531: can't get code and errorMsg in SendMessageContext when runing executeSendMessageHookAfter
URL: https://github.com/apache/rocketmq/issues/531
 
 
   **BUG REPORT**
   Please describe the issue you observed:
   - I can't get code and errorMsg in SendMessageContext when runing executeSendMessageHookAfter
   
   Please tell us about your environment:
   - 4.3.1
   
   Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):
   
   I have checked the code.  **SendMessageProcessor.handlePutMessageResult** always returns null.
   ```java
        if (sendOK) {
               //xxxxxx
               return null;
          } 
   ```
   So the code **response != null**  is false all the time.
   
   ```java
       public void executeSendMessageHookAfter(final RemotingCommand response, final SendMessageContext context) {
           if (hasSendMessageHook()) {
               for (SendMessageHook hook : this.sendMessageHookList) {
                   try {
                       if (response != null) {
                         //xxxxx
                           context.setCode(response.getCode());
                           context.setErrorMsg(response.getRemark());
                       }
                       hook.sendMessageAfter(context);
                   } catch (Throwable e) {
                       // Ignore
                   }
               }
           }
       }
   ```
   
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services