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 2019/01/15 01:55:20 UTC

[GitHub] ShannonDing commented on a change in pull request #65: Realization C asynSend

ShannonDing commented on a change in pull request #65: Realization C asynSend 
URL: https://github.com/apache/rocketmq-client-cpp/pull/65#discussion_r246770761
 
 

 ##########
 File path: src/extern/CProducer.cpp
 ##########
 @@ -127,6 +162,22 @@ int SendMessageSync(CProducer *producer, CMessage *msg, CSendResult *result) {
     return OK;
 }
 
+int SendMessageAsync(CProducer *producer, CMessage *msg, CSendSuccessCallback cSendSuccessCallback,CSendExceptionCallback cSendExceptionCallback){
+	if (producer == NULL || msg == NULL || cSendSuccessCallback == NULL || cSendExceptionCallback == NULL) {
+		return NULL_POINTER;
+	}
+	DefaultMQProducer *defaultMQProducer = (DefaultMQProducer *) producer;
+	MQMessage *message = (MQMessage *) msg;
+	CSendCallback* cSendCallback = new CSendCallback(cSendSuccessCallback , cSendExceptionCallback);
+
+	try {
+		defaultMQProducer->send(*message ,cSendCallback);
+	} catch (exception &e) {
+		return PRODUCER_SEND_ONEWAY_FAILED;
 
 Review comment:
   The error code is not right.

----------------------------------------------------------------
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