Skip to content

Commit

Permalink
Support set max cache size for consumer.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShannonDing committed Sep 24, 2019
1 parent 352ea92 commit 77e6b8f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion include/CCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ typedef enum _CStatus_ {
PULLCONSUMER_ERROR_CODE_START = 30,
PULLCONSUMER_START_FAILED = 30,
PULLCONSUMER_FETCH_MQ_FAILED = 31,
PULLCONSUMER_FETCH_MESSAGE_FAILED = 32
PULLCONSUMER_FETCH_MESSAGE_FAILED = 32,

Not_Support = 500
} CStatus;

typedef enum _CLogLevel_ {
Expand Down
4 changes: 3 additions & 1 deletion include/CPushConsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#ifndef __C_PUSH_CONSUMER_H__
#define __C_PUSH_CONSUMER_H__

#include "CMessageExt.h"
#include "CCommon.h"
#include "CMessageExt.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -56,6 +56,8 @@ ROCKETMQCLIENT_API int SetPushConsumerLogPath(CPushConsumer* consumer, const cha
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);
ROCKETMQCLIENT_API int SetPushConsumerMaxCacheMessageSize(CPushConsumer* consumer, int maxCacheSize);
ROCKETMQCLIENT_API int SetPushConsumerMaxCacheMessageSizeInMb(CPushConsumer* consumer, int maxCacheSizeInMb);

#ifdef __cplusplus
};
Expand Down
13 changes: 13 additions & 0 deletions src/extern/CPushConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,20 @@ int SetPushConsumerMessageBatchMaxSize(CPushConsumer* consumer, int batchSize) {
((DefaultMQPushConsumer*)consumer)->setConsumeMessageBatchMaxSize(batchSize);
return OK;
}
int SetPushConsumerMaxCacheMessageSize(CPushConsumer* consumer, int maxCacheSize) {
if (consumer == NULL || maxCacheSize <= 0) {
return NULL_POINTER;
}
((DefaultMQPushConsumer*)consumer)->setMaxCacheMsgSizePerQueue(maxCacheSize);
return OK;
}

int SetPushConsumerMaxCacheMessageSizeInMb(CPushConsumer* consumer, int maxCacheSizeInMb) {
if (consumer == NULL || maxCacheSizeInMb <= 0) {
return NULL_POINTER;
}
return Not_Support;
}
int SetPushConsumerInstanceName(CPushConsumer* consumer, const char* instanceName) {
if (consumer == NULL) {
return NULL_POINTER;
Expand Down

0 comments on commit 77e6b8f

Please sign in to comment.