You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tubemq.apache.org by go...@apache.org on 2020/09/15 13:03:43 UTC
[incubator-tubemq] branch master updated: [TUBEMQ-352]Set the
parameters of the example at startup (#265)
This is an automated email from the ASF dual-hosted git repository.
gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tubemq.git
The following commit(s) were added to refs/heads/master by this push:
new 7e22a4d [TUBEMQ-352]Set the parameters of the example at startup (#265)
7e22a4d is described below
commit 7e22a4d057e2f36a0558bf674b0a2cf30530996d
Author: gosonzhang <46...@qq.com>
AuthorDate: Tue Sep 15 21:03:34 2020 +0800
[TUBEMQ-352]Set the parameters of the example at startup (#265)
Co-authored-by: gosonzhang <go...@tencent.com>
---
.../tubemq-client-cpp/example/consumer/test_consumer.cc | 17 +++++++++++++----
.../example/consumer/test_multithread_pull.cc | 17 ++++++++++++++---
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_consumer.cc b/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_consumer.cc
index bd1b487..d719fcb 100644
--- a/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_consumer.cc
+++ b/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_consumer.cc
@@ -56,13 +56,22 @@ using tubemq::TubeMQConsumer;
int main(int argc, char* argv[]) {
bool result;
string err_info;
+ if (argc < 4) {
+ printf("\n must ./comd master_addr group_name topic_name [config_file_path]");
+ return -1;
+ }
+ // set parameters
+ string master_addr = argv[1];
+ string group_name = argv[2];
+ string topic_name = argv[3];
string conf_file = "../conf/client.conf";
- string group_name = "test_c_v8";
- string master_addr = "10.215.128.83:8000,10.215.128.83:8000";
- TubeMQConsumer consumer_1;
+ if (argc > 4) {
+ conf_file = argv[4];
+ }
+ TubeMQConsumer consumer_1;
set<string> topic_list;
- topic_list.insert("test_1");
+ topic_list.insert(topic_name);
ConsumerConfig consumer_config;
consumer_config.SetRpcReadTimeoutMs(20000);
diff --git a/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_multithread_pull.cc b/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_multithread_pull.cc
index fc0bf8f..1fdc5cd 100644
--- a/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_multithread_pull.cc
+++ b/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_multithread_pull.cc
@@ -109,12 +109,23 @@ void thread_task_pull(int32_t thread_no) {
int main(int argc, char* argv[]) {
bool result;
string err_info;
+
+ if (argc < 4) {
+ printf("\n must ./comd master_addr group_name topic_name [config_file_path]");
+ return -1;
+ }
+ // set parameters
+ string master_addr = argv[1];
+ string group_name = argv[2];
+ string topic_name = argv[3];
string conf_file = "../conf/client.conf";
- string group_name = "test_c_v8";
- string master_addr = "10.215.128.83:8000,10.215.128.83:8000";
+ if (argc > 4) {
+ conf_file = argv[4];
+ }
+
int32_t thread_num = 15;
set<string> topic_list;
- topic_list.insert("test_1");
+ topic_list.insert(topic_name);
ConsumerConfig consumer_config;
consumer_config.SetRpcReadTimeoutMs(20000);