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 98f4880d chore: polish example with preferred withTopics (#544)
98f4880d is described below

commit 98f4880d113b7def125115453cb7c41e4908e573
Author: yulangz <53958801+yula...@users.noreply.github.com>
AuthorDate: Mon Oct 9 18:20:17 2023 +0800

    chore: polish example with preferred withTopics (#544)
    
    Signed-off-by: Li Zhanhui <lizhan...@gmail.com>
    Co-authored-by: htaowang <htaow...@tencent.com>
---
 cpp/examples/ExampleProducer.cpp                | 3 ++-
 cpp/examples/ExampleProducerWithAsync.cpp       | 1 +
 cpp/examples/ExampleProducerWithFifoMessage.cpp | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/cpp/examples/ExampleProducer.cpp b/cpp/examples/ExampleProducer.cpp
index ca5fc7d7..57293c24 100644
--- a/cpp/examples/ExampleProducer.cpp
+++ b/cpp/examples/ExampleProducer.cpp
@@ -72,13 +72,14 @@ int main(int argc, char* argv[]) {
     credentials_provider = 
std::make_shared<StaticCredentialsProvider>(FLAGS_access_key, 
FLAGS_access_secret);
   }
 
-  // In most case, you don't need to create too many producers, singletion 
pattern is recommended.
+  // In most case, you don't need to create too many producers, singleton 
pattern is recommended.
   auto producer = Producer::newBuilder()
                       .withConfiguration(Configuration::newBuilder()
                                              .withEndpoints(FLAGS_access_point)
                                              
.withCredentialsProvider(credentials_provider)
                                              .withSsl(true)
                                              .build())
+                      .withTopics({FLAGS_topic})
                       .build();
 
   std::atomic_bool stopped;
diff --git a/cpp/examples/ExampleProducerWithAsync.cpp 
b/cpp/examples/ExampleProducerWithAsync.cpp
index d8846b49..62ee7781 100644
--- a/cpp/examples/ExampleProducerWithAsync.cpp
+++ b/cpp/examples/ExampleProducerWithAsync.cpp
@@ -118,6 +118,7 @@ int main(int argc, char* argv[]) {
                                              
.withCredentialsProvider(credentials_provider)
                                              .withSsl(true)
                                              .build())
+                      .withTopics({FLAGS_topic})
                       .build();
 
   std::atomic_bool stopped;
diff --git a/cpp/examples/ExampleProducerWithFifoMessage.cpp 
b/cpp/examples/ExampleProducerWithFifoMessage.cpp
index e8a6f209..09b8d407 100644
--- a/cpp/examples/ExampleProducerWithFifoMessage.cpp
+++ b/cpp/examples/ExampleProducerWithFifoMessage.cpp
@@ -76,6 +76,7 @@ int main(int argc, char* argv[]) {
                                              
.withCredentialsProvider(credentials_provider)
                                              .withSsl(true)
                                              .build())
+                      .withTopics({FLAGS_topic})
                       .build();
 
   std::atomic_bool stopped;

Reply via email to