You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by "Zintoki (via GitHub)" <gi...@apache.org> on 2023/07/10 15:07:04 UTC

[GitHub] [rocketmq-clients] Zintoki created a discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

GitHub user Zintoki created a discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

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);
}

GitHub link: https://github.com/apache/rocketmq-clients/discussions/565

----
This is an automatically sent email for dev@rocketmq.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@rocketmq.apache.org


[GitHub] [rocketmq-clients] Zintoki added a comment to the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

Posted by "Zintoki (via GitHub)" <gi...@apache.org>.
GitHub user Zintoki added a comment to the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

我使用bazel完成了编译,cmake编译我并没有尝试过,cpp 5.x客户端貌似依赖特定版本的库



---原始邮件---
发件人: ***@***.***&gt;
发送时间: 2023年8月29日(周二) 中午12:46
收件人: ***@***.***&gt;;
抄送: ***@***.******@***.***&gt;;
主题: 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: ***@***.***&gt;

GitHub link: https://github.com/apache/rocketmq-clients/discussions/565#discussioncomment-6848863

----
This is an automatically sent email for dev@rocketmq.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@rocketmq.apache.org


[GitHub] [rocketmq-clients] lazyman1992 added a comment to the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

Posted by "lazyman1992 (via GitHub)" <gi...@apache.org>.
GitHub user lazyman1992 added a comment to the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

感觉是的

GitHub link: https://github.com/apache/rocketmq-clients/discussions/565#discussioncomment-6849348

----
This is an automatically sent email for dev@rocketmq.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@rocketmq.apache.org


[GitHub] [rocketmq-clients] lazyman1992 added a comment to the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

Posted by "lazyman1992 (via GitHub)" <gi...@apache.org>.
GitHub user lazyman1992 added a comment to the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

感觉是的

GitHub link: https://github.com/apache/rocketmq-clients/discussions/565#discussioncomment-6849350

----
This is an automatically sent email for dev@rocketmq.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@rocketmq.apache.org


[GitHub] [rocketmq-clients] lazyman1992 deleted a comment on the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

Posted by "lazyman1992 (via GitHub)" <gi...@apache.org>.
GitHub user lazyman1992 deleted a comment on the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

感觉是的

GitHub link: https://github.com/apache/rocketmq-clients/discussions/565#discussioncomment-6849348

----
This is an automatically sent email for dev@rocketmq.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@rocketmq.apache.org


[GitHub] [rocketmq-clients] lazyman1992 added a comment to the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

Posted by "lazyman1992 (via GitHub)" <gi...@apache.org>.
GitHub user lazyman1992 added a comment to the discussion: clients-cpp测试延时消息时,出现terminate called without an active exception,不清楚有何问题

cpp怎么编过的啊,关于absl和protobuf一直报错,这两块有版本和CMAKE_CXX_STANDARD的要求么

GitHub link: https://github.com/apache/rocketmq-clients/discussions/565#discussioncomment-6848839

----
This is an automatically sent email for dev@rocketmq.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@rocketmq.apache.org