-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export send batch messages api in c style. #139
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice job.
include/CBatchMessage.h
Outdated
typedef struct CBatchMessage CBatchMessage; | ||
|
||
ROCKETMQCLIENT_API CBatchMessage* CreateBatchMessage(); | ||
ROCKETMQCLIENT_API int addMessage(CBatchMessage* batchMsg, CMessage* msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename with big camel-case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already processed
|
||
using std::vector; | ||
|
||
#ifdef __cplusplus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is cpp, the if is unnecessary. and i think the extern is unnecessary too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the C interface and must be ifdef
这是c接口,必须ifdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个肯定是要用c++编译器编译的,只要用了c++编译器,就一定会定义__cplusplus,所以你的说法是没道理的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c接口应该只要在声明的时候用extern “c”包起来就可以了,.cpp实现的时候没必要再次用extern c。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其他extern实现类,都是这样实现的。如果需要进行整理,大家讨论下。
|
||
int main(int argc, char* argv[]) { | ||
printf("Send Batch.....\n"); | ||
CreateProducerAndStartSendMessage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only call CreateProducerAndStartSendMessage in main, so i think the function is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code structure is clear and consistent with the C case in other examples, which is easy to understand.
代码结构清晰点,同时与其他example中c案例一致,便于理解
LGTM |
What is the purpose of the change
C batch sending interface
Brief changelog
Verifying this change
see example/CBatchProducer.c
Follow this checklist to help us incorporate your contribution quickly and easily. Notice,
it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR
.[ISSUE #123] Fix UnknownException when host config not exist
. Each commit in the pull request should have a meaningful subject line and body.