Skip to content

Commit 45c73a1

Browse files
committed
Use Producer rather than Consumer in metadata example
1 parent 56d594d commit 45c73a1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

examples/metadata.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <iostream>
33
#include <csignal>
44
#include <boost/program_options.hpp>
5-
#include "cppkafka/consumer.h"
5+
#include "cppkafka/producer.h"
66
#include "cppkafka/configuration.h"
77
#include "cppkafka/metadata.h"
88
#include "cppkafka/topic.h"
@@ -12,7 +12,7 @@ using std::exception;
1212
using std::cout;
1313
using std::endl;
1414

15-
using cppkafka::Consumer;
15+
using cppkafka::Producer;
1616
using cppkafka::Exception;
1717
using cppkafka::Configuration;
1818
using cppkafka::Topic;
@@ -33,8 +33,6 @@ int main(int argc, char* argv[]) {
3333
("help,h", "produce this help message")
3434
("brokers,b", po::value<string>(&brokers)->required(),
3535
"the kafka broker list")
36-
("group-id,g", po::value<string>(&group_id)->required(),
37-
"the consumer group id")
3836
;
3937

4038
po::variables_map vm;
@@ -56,17 +54,16 @@ int main(int argc, char* argv[]) {
5654
// Construct the configuration
5755
Configuration config = {
5856
{ "metadata.broker.list", brokers },
59-
{ "group.id", group_id },
6057
// Disable auto commit
6158
{ "enable.auto.commit", false }
6259
};
6360

6461
try {
65-
// Construct a consumer
66-
Consumer consumer(config);
62+
// Construct a producer
63+
Producer producer(config);
6764

6865
// Fetch the metadata
69-
Metadata metadata = consumer.get_metadata();
66+
Metadata metadata = producer.get_metadata();
7067

7168
// Iterate over brokers
7269
cout << "Found the following brokers: " << endl;

0 commit comments

Comments
 (0)