rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ding...@apache.org
Subject [rocketmq-client-cpp] branch master updated: [ISSUE #118] Support send message oneway orderly for C API
Date Thu, 04 Apr 2019 07:13:59 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 3d524c6  [ISSUE #118] Support send message oneway orderly for C API
3d524c6 is described below

commit 3d524c6081c242af488e1e12d88ff931bafbe215
Author: donggang123 <jonnxu@163.com>
AuthorDate: Thu Apr 4 15:13:55 2019 +0800

    [ISSUE #118] Support send message oneway orderly for C API
    
    [ISSUE #118] Support send message oneway orderly for C API
---
 include/CProducer.h      |  1 +
 src/extern/CProducer.cpp | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/CProducer.h b/include/CProducer.h
index 5518a56..c542dc2 100644
--- a/include/CProducer.h
+++ b/include/CProducer.h
@@ -53,6 +53,7 @@ ROCKETMQCLIENT_API int SetProducerMaxMessageSize(CProducer *producer, int
size);
 ROCKETMQCLIENT_API int SendMessageSync(CProducer *producer, CMessage *msg, CSendResult *result);
 ROCKETMQCLIENT_API int SendMessageAsync(CProducer *producer, CMessage *msg, CSendSuccessCallback
cSendSuccessCallback , CSendExceptionCallback cSendExceptionCallback);
 ROCKETMQCLIENT_API int SendMessageOneway(CProducer *producer,CMessage *msg);
+ROCKETMQCLIENT_API int SendMessageOnewayOrderly(CProducer *producer,CMessage *msg, QueueSelectorCallback
selector, void* arg);
 ROCKETMQCLIENT_API int SendMessageOrderly(CProducer *producer, CMessage *msg, QueueSelectorCallback
callback, void *arg, int autoRetryTimes, CSendResult *result);
 
 
diff --git a/src/extern/CProducer.cpp b/src/extern/CProducer.cpp
index de2cfe0..58542a6 100644
--- a/src/extern/CProducer.cpp
+++ b/src/extern/CProducer.cpp
@@ -196,6 +196,21 @@ int SendMessageOneway(CProducer *producer, CMessage *msg) {
     return OK;
 }
 
+int SendMessageOnewayOrderly(CProducer *producer, CMessage *msg, QueueSelectorCallback selector,
void* arg) {
+    if (producer == NULL || msg == NULL) {
+        return NULL_POINTER;
+    }
+    DefaultMQProducer *defaultMQProducer = (DefaultMQProducer *) producer;
+    MQMessage *message = (MQMessage *) msg;
+    try {
+        SelectMessageQueue selectMessageQueue(selector);
+        defaultMQProducer->sendOneway(*message, &selectMessageQueue, arg);
+    } catch (exception &e) {
+        return PRODUCER_SEND_ONEWAY_FAILED;
+    }
+    return OK;
+}
+
 int
 SendMessageOrderlyAsync(CProducer *producer,
             CMessage *msg,


Mime
View raw message