rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From duhengfore...@apache.org
Subject [rocketmq-ons] 05/43: Call onException instead of throw exception when async sending
Date Fri, 06 Dec 2019 04:22:27 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 3f9457e265a6fdece1a3ac8147adab3396c7fd12
Author: ShannonDing <libya_003@163.com>
AuthorDate: Mon Jun 17 16:30:20 2019 +0800

    Call onException instead of throw exception when async sending
---
 .../org/apache/rocketmq/ons/api/impl/rocketmq/ProducerImpl.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 6118435..921861a 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,7 +169,13 @@ 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);
+            //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);
         }
     }
 


Mime
View raw message