Skip to content
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

Merged
merged 4 commits into from
Jul 8, 2019
Merged

Export send batch messages api in c style. #139

merged 4 commits into from
Jul 8, 2019

Conversation

githublaohu
Copy link
Contributor

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.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when a cross-module dependency exists.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

Copy link
Contributor

@ifplusor ifplusor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice job.

typedef struct CBatchMessage CBatchMessage;

ROCKETMQCLIENT_API CBatchMessage* CreateBatchMessage();
ROCKETMQCLIENT_API int addMessage(CBatchMessage* batchMsg, CMessage* msg);
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@ifplusor ifplusor Apr 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个肯定是要用c++编译器编译的,只要用了c++编译器,就一定会定义__cplusplus,所以你的说法是没道理的。

Copy link
Contributor

@ifplusor ifplusor Apr 21, 2019

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。

Copy link
Contributor Author

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();
Copy link
Contributor

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.

Copy link
Contributor Author

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案例一致,便于理解

@ShannonDing ShannonDing changed the title bacht send message Export send batch messages api in c style. Apr 22, 2019
@ShannonDing ShannonDing added this to the 1.2.3 milestone Apr 23, 2019
@jonnxu
Copy link
Contributor

jonnxu commented Jul 8, 2019

LGTM

@jonnxu jonnxu merged commit 94d97a0 into apache:master Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants