| | |
| | | } |
| | | printf("\n"); |
| | | }; |
| | | { |
| | | if (0) { |
| | | // query procs |
| | | std::string dest(BHAddress().SerializeAsString()); |
| | | MsgQueryProc query; |
| | |
| | | // printf("register topic : %s\n", r ? "ok" : "failed"); |
| | | // Sleep(1s); |
| | | } |
| | | { |
| | | for (int i = 0; i < 3; ++i) { |
| | | // query procs with normal topic request |
| | | MsgRequestTopic req; |
| | | req.set_topic("#center_query_procs"); |
| | | // req.set_data("{\"proc_id\":\"#center.node\"}"); |
| | | std::string s(req.SerializeAsString()); |
| | | // Sleep(10ms, false); |
| | | std::string dest(BHAddress().SerializeAsString()); |
| | | BHAddress host; |
| | | printf("query with ip set\n"); |
| | | host.set_ip("127.0.0.1"); |
| | | host.set_port(kBHCenterPort); |
| | | host.set_mq_id(1000011); |
| | | host.set_abs_addr(10296); |
| | | |
| | | std::string dest(host.SerializeAsString()); |
| | | void *proc_id = 0; |
| | | int proc_id_len = 0; |
| | | DEFER1(BHFree(proc_id, proc_id_len);); |
| | |
| | | } else { |
| | | MsgRequestTopicReply ret; |
| | | ret.ParseFromArray(reply, reply_len); |
| | | printf("topic query proc : %s\n", ret.data().c_str()); |
| | | printf("\ntopic query proc : %s\n", ret.data().c_str()); |
| | | // MsgQueryProcReply result; |
| | | // if (result.ParseFromArray(ret.data().data(), ret.data().size()) && IsSuccess(result.errmsg().errcode())) { |
| | | // PrintProcs(result); |
| | |
| | | for (int i = 0; i < 1; ++i) { |
| | | MsgPublish pub; |
| | | pub.set_topic(topic_ + std::to_string(i)); |
| | | pub.set_data("pub_data_" + std::string(1024 * 1, 'a')); |
| | | pub.set_data("pub_data_" + std::string(104 * 1, 'a')); |
| | | std::string s(pub.SerializeAsString()); |
| | | BHPublish(s.data(), s.size(), 0); |
| | | // Sleep(1s); |