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 2018/11/30 02:06:26 UTC

[GitHub] vongosling closed pull request #18: Add C-Style API setMessageModel

vongosling closed pull request #18: Add C-Style API setMessageModel
URL: https://github.com/apache/rocketmq-client-cpp/pull/18
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/include/CCommon.h b/include/CCommon.h
index 44ed12db..a5d04b7b 100644
--- a/include/CCommon.h
+++ b/include/CCommon.h
@@ -40,6 +40,10 @@ typedef enum _CLogLevel_{
     E_LOG_LEVEL_TRACE = 6,
     E_LOG_LEVEL_LEVEL_NUM = 7
 } CLogLevel;
+typedef enum _CMessageModel_{
+    BROADCASTING,
+    CLUSTERING
+} CMessageModel;
 #ifdef __cplusplus
 };
 #endif
diff --git a/include/CPushConsumer.h b/include/CPushConsumer.h
index f954f289..aee34403 100644
--- a/include/CPushConsumer.h
+++ b/include/CPushConsumer.h
@@ -43,7 +43,10 @@ ROCKETMQCLIENT_API int SetPushConsumerGroupID(CPushConsumer *consumer, const cha
 ROCKETMQCLIENT_API const char *GetPushConsumerGroupID(CPushConsumer *consumer);
 ROCKETMQCLIENT_API int SetPushConsumerNameServerAddress(CPushConsumer *consumer, const char *namesrv);
 ROCKETMQCLIENT_API int Subscribe(CPushConsumer *consumer, const char *topic, const char *expression);
+ROCKETMQCLIENT_API int RegisterMessageCallbackOrderly(CPushConsumer *consumer, MessageCallBack pCallback);
 ROCKETMQCLIENT_API int RegisterMessageCallback(CPushConsumer *consumer, MessageCallBack pCallback);
+ROCKETMQCLIENT_API int UnregisterMessageCallbackOrderly(CPushConsumer *consumer);
+ROCKETMQCLIENT_API int UnregisterMessageCallback(CPushConsumer *consumer);
 ROCKETMQCLIENT_API int SetPushConsumerThreadCount(CPushConsumer *consumer, int threadCount);
 ROCKETMQCLIENT_API int SetPushConsumerMessageBatchMaxSize(CPushConsumer *consumer, int batchSize);
 ROCKETMQCLIENT_API int SetPushConsumerInstanceName(CPushConsumer *consumer, const char *instanceName);
@@ -51,6 +54,7 @@ ROCKETMQCLIENT_API int SetPushConsumerSessionCredentials(CPushConsumer *consumer
 ROCKETMQCLIENT_API int SetPushConsumerLogPath(CPushConsumer *consumer, const char *logPath);
 ROCKETMQCLIENT_API int SetPushConsumerLogFileNumAndSize(CPushConsumer *consumer, int fileNum, long fileSize);
 ROCKETMQCLIENT_API int SetPushConsumerLogLevel(CPushConsumer *consumer, CLogLevel level);
+ROCKETMQCLIENT_API int SetPushConsumerMessageModel(CPushConsumer *consumer, CMessageModel messageModel);
   
 #ifdef __cplusplus
 };
diff --git a/src/extern/CPushConsumer.cpp b/src/extern/CPushConsumer.cpp
index 1738b5f2..1607069f 100644
--- a/src/extern/CPushConsumer.cpp
+++ b/src/extern/CPushConsumer.cpp
@@ -193,6 +193,14 @@ int UnregisterMessageCallback(CPushConsumer *consumer) {
     }
     return OK;
 }
+
+int SetPushConsumerMessageModel(CPushConsumer *consumer, CMessageModel messageModel){
+    if(conusmer == NULL){
+        return NULL_POINTER;
+    }
+    ((DefaultMQPushConsumer *) consumer)->setMessageModel(MessageModel((int)messageModel));
+    return OK;
+}
 int SetPushConsumerThreadCount(CPushConsumer *consumer, int threadCount) {
     if (consumer == NULL || threadCount == 0) {
         return NULL_POINTER;


 

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