You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2022/07/28 06:50:48 UTC

[rocketmq-clients] branch master updated: Minor polishment of transactional message example

This is an automated email from the ASF dual-hosted git repository.

lizhanhui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new dc9331f  Minor polishment of transactional message example
dc9331f is described below

commit dc9331f7ea1c5402cbb214ecbf296f4e9f048e28
Author: Li Zhanhui <li...@gmail.com>
AuthorDate: Thu Jul 28 14:47:38 2022 +0800

    Minor polishment of transactional message example
---
 cpp/examples/ExampleProducerWithTransactionalMessage.cpp | 4 ++++
 cpp/source/client/TelemetryBidiReactor.cpp               | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/cpp/examples/ExampleProducerWithTransactionalMessage.cpp b/cpp/examples/ExampleProducerWithTransactionalMessage.cpp
index c220cf7..f32490b 100644
--- a/cpp/examples/ExampleProducerWithTransactionalMessage.cpp
+++ b/cpp/examples/ExampleProducerWithTransactionalMessage.cpp
@@ -79,6 +79,7 @@ int main(int argc, char* argv[]) {
                                              .withEndpoints(FLAGS_access_point)
                                              .withCredentialsProvider(credentials_provider)
                                              .build())
+                      .withTopics({FLAGS_topic})
                       .withTransactionChecker(checker)
                       .build();
 
@@ -122,5 +123,8 @@ int main(int argc, char* argv[]) {
     stats_thread.join();
   }
 
+  std::cout << "Wait 5 minutes for potential unresolved transactional message callback" << std::endl;
+  std::this_thread::sleep_for(std::chrono::minutes(5));
+
   return EXIT_SUCCESS;
 }
\ No newline at end of file
diff --git a/cpp/source/client/TelemetryBidiReactor.cpp b/cpp/source/client/TelemetryBidiReactor.cpp
index 5120ad2..6c5b2f9 100644
--- a/cpp/source/client/TelemetryBidiReactor.cpp
+++ b/cpp/source/client/TelemetryBidiReactor.cpp
@@ -137,7 +137,7 @@ void TelemetryBidiReactor::OnReadDone(bool ok) {
         fireClose();
         return;
       }
-
+      SPDLOG_DEBUG("Receive orphan transaction command: {}", read_.DebugString());
       auto message = client->manager()->wrapMessage(read_.release_verify_message_command()->message());
       auto raw = const_cast<Message*>(message.get());
       raw->mutableExtension().target_endpoint = peer_address_;