You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2019/07/17 05:35:15 UTC

[rocketmq-ons] 07/25: Keep runtime exception throw

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

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

commit 2a87d338e3fa56f54fa70fd1d335bd02150f0961
Author: ShannonDing <li...@163.com>
AuthorDate: Mon Jun 17 17:17:37 2019 +0800

    Keep runtime exception throw
---
 .../rocketmq/ons/api/impl/rocketmq/ProducerImpl.java       | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
index 921861a..9710b33 100644
--- a/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
+++ b/ons-core/ons-client/src/main/java/org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java
@@ -169,13 +169,7 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
             message.setMsgID(MessageClientIDSetter.getUniqID(msgRMQ));
         } catch (Exception e) {
             LOGGER.error(String.format("Send message async Exception, %s", message), e);
-            //throw checkProducerException(message.getTopic(), message.getMsgID(), e);
-            ONSClientException clientException = checkProducerException(message.getTopic(), message.getMsgID(), e);
-            OnExceptionContext context = new OnExceptionContext();
-            context.setException(clientException);
-            context.setTopic(message.getTopic());
-            context.setMessageId(message.getMsgID());
-            sendCallback.onException(context);
+            throw checkProducerException(message.getTopic(), message.getMsgID(), e);
         }
     }
 
@@ -199,11 +193,11 @@ public class ProducerImpl extends ONSClientAbstract implements Producer {
             @Override
             public void onException(Throwable e) {
                 //String topic = new String(message.getTopic());
-                String msgId = new String(message.getMsgID());
-                ONSClientException onsEx = checkProducerException(message.getTopic(), msgId, e);
+                //String msgId = new String(message.getMsgID());
+                ONSClientException onsEx = checkProducerException(message.getTopic(), message.getMsgID(), e);
                 OnExceptionContext context = new OnExceptionContext();
                 context.setTopic(message.getTopic());
-                context.setMessageId(msgId);
+                context.setMessageId(message.getMsgID());
                 context.setException(onsEx);
                 sendCallback.onException(context);
             }