You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by if...@apache.org on 2020/12/29 03:36:26 UTC

[rocketmq-client-cpp] 09/29: fix: missing include functional

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

ifplusor pushed a commit to branch re_dev
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git

commit 15a8b0b253e62d52ee0464a0f3915c465360c5bc
Author: James Yin <yw...@hotmail.com>
AuthorDate: Thu Aug 6 23:07:02 2020 +0800

    fix: missing include functional
---
 example/common.h                       | 1 +
 src/producer/DefaultMQProducerImpl.cpp | 6 +++---
 src/protocol/ConsumerRunningInfo.cpp   | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/example/common.h b/example/common.h
index 3a6e46e..393fda0 100644
--- a/example/common.h
+++ b/example/common.h
@@ -19,6 +19,7 @@
 
 #include <atomic>
 #include <chrono>
+#include <functional>
 #include <iostream>
 #include <memory>
 #include <string>
diff --git a/src/producer/DefaultMQProducerImpl.cpp b/src/producer/DefaultMQProducerImpl.cpp
index 158dc4d..e5ef3b0 100644
--- a/src/producer/DefaultMQProducerImpl.cpp
+++ b/src/producer/DefaultMQProducerImpl.cpp
@@ -261,7 +261,7 @@ void DefaultMQProducerImpl::send(MQMessage& msg,
 void DefaultMQProducerImpl::sendOneway(MQMessage& msg) {
   try {
     sendDefaultImpl(msg.getMessageImpl(), CommunicationMode::ONEWAY, nullptr, m_producerConfig->getSendMsgTimeout());
-  } catch (MQBrokerException e) {
+  } catch (MQBrokerException& e) {
     std::string info = std::string("unknown exception, ") + e.what();
     THROW_MQEXCEPTION(MQClientException, info, e.GetError());
   }
@@ -277,7 +277,7 @@ void DefaultMQProducerImpl::sendOneway(MQMessage& msg, const MQMessageQueue& mq)
   try {
     sendKernelImpl(msg.getMessageImpl(), mq, CommunicationMode::ONEWAY, nullptr, nullptr,
                    m_producerConfig->getSendMsgTimeout());
-  } catch (MQBrokerException e) {
+  } catch (MQBrokerException& e) {
     std::string info = std::string("unknown exception, ") + e.what();
     THROW_MQEXCEPTION(MQClientException, info, e.GetError());
   }
@@ -333,7 +333,7 @@ void DefaultMQProducerImpl::sendOneway(MQMessage& msg, MessageQueueSelector* sel
   try {
     sendSelectImpl(msg.getMessageImpl(), selector, arg, CommunicationMode::ONEWAY, nullptr,
                    m_producerConfig->getSendMsgTimeout());
-  } catch (MQBrokerException e) {
+  } catch (MQBrokerException& e) {
     std::string info = std::string("unknown exception, ") + e.what();
     THROW_MQEXCEPTION(MQClientException, info, e.GetError());
   }
diff --git a/src/protocol/ConsumerRunningInfo.cpp b/src/protocol/ConsumerRunningInfo.cpp
index 3f1b81e..19f5fff 100644
--- a/src/protocol/ConsumerRunningInfo.cpp
+++ b/src/protocol/ConsumerRunningInfo.cpp
@@ -16,6 +16,7 @@
  */
 #include "ConsumerRunningInfo.h"
 
+#include "RemotingSerializable.h"
 #include "UtilAll.h"
 
 namespace rocketmq {
@@ -89,8 +90,7 @@ std::string ConsumerRunningInfo::encode() {
     root["subscriptionSet"].append(subscription.toJson());
   }
 
-  Json::FastWriter fastwrite;
-  std::string finals = fastwrite.write(root);
+  std::string finals = RemotingSerializable::toJson(root);
 
   Json::Value mq;
   std::string key = "\"mqTable\":";