Replies: 2 comments 1 reply
-
cpp怎么编过的啊,关于absl和protobuf一直报错,这两块有版本和CMAKE_CXX_STANDARD的要求么 |
Beta Was this translation helpful? Give feedback.
0 replies
-
我使用bazel完成了编译,cmake编译我并没有尝试过,cpp 5.x客户端貌似依赖特定版本的库
…---原始邮件---
发件人: ***@***.***>
发送时间: 2023年8月29日(周二) 中午12:46
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [apache/rocketmq-clients] clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题 (Discussion #565)
cpp怎么编过的啊,关于absl和protobuf一直报错,这两块有版本和CMAKE_CXX_STANDARD的要求么
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TEST_F(DelayMessageTest, ttt){
std::string access_point = "127.0.0.1:8081";
std::string methodName = "testDelay_Send_PushConsume";
std::string topic = getTopic("DELAY", methodName, "127.0.0.1:10911");
std::string groupId = getGroupId(methodName);
std::atomic_long receive_count(0);
auto listener = [&](const Message& message) {
std::cout << "\033[0;33m Received a message[topic=" << message.topic() << ", MsgId=" << message.id() << "]" << "\033[0m" << std::endl;
receive_count++;
return ConsumeResult::SUCCESS;
};
auto push_consumer = PushConsumer::newBuilder()
.withGroup(groupId)
.withConfiguration(Configuration::newBuilder()
.withEndpoints(access_point)
.withRequestTimeout(std::chrono::seconds(1))
.build())
.withConsumeThreads(0)
.withListener(listener)
.subscribe(topic, d->getTag())
.build();
std::this_thread::sleep_for(std::chrono::seconds(10));
auto producer = ROCKETMQ_NAMESPACE::Producer::newBuilder().withConfiguration(ROCKETMQ_NAMESPACE::Configuration::newBuilder().withEndpoints(access_point).build()).build();
std::atomic_long send_count(0);
try
{
for (std::size_t i = 0; i < 5; ++i)
{
auto message = ROCKETMQ_NAMESPACE::Message::newBuilder()
.withTopic(topic)
.withTag(d->getTag())
.withKeys({std::to_string(i)})
.withBody(RandomUtils::getStringByUUID())
.availableAfter(
std::chrono::system_clock::now() +
std::chrono::seconds(1)) // This message would be available to consumers after 10 seconds
.build();
std::error_code ec;
ROCKETMQ_NAMESPACE::SendReceipt send_receipt = producer.send(std::move(message), ec);
std::cout << "\033[0;32m Message-ID: " << send_receipt.message_id << "\033[0m" << std::endl;
send_count++;
}
}
catch (...)
{
std::cerr << "Ah...No!!!" << std::endl;
}
std::this_thread::sleep_for(std::chrono::seconds(10));
ASSERT_EQ(receive_count, send_count);
}
Beta Was this translation helpful? Give feedback.
All reactions