Skip to content

Commit b7439a7

Browse files
tbsaundeedenhill
authored andcommitted
Add list_topics() API (confluentinc#161, @tbsaunde, @stephan-hof)
* Add 'get_metadata' to Producer and Consumer. * Expose metadata in a way similar to the java API
1 parent 66a1814 commit b7439a7

File tree

5 files changed

+409
-2
lines changed

5 files changed

+409
-2
lines changed

confluent_kafka/src/Consumer.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,15 @@ static PyMethodDef Consumer_methods[] = {
12651265
" :raises: RuntimeError if called on a closed consumer\n"
12661266
"\n"
12671267
},
1268+
1269+
{
1270+
"list_topics",
1271+
(PyCFunction)get_metadata,
1272+
METH_VARARGS|METH_KEYWORDS,
1273+
get_metadata_doc
1274+
},
1275+
1276+
12681277
{ NULL }
12691278
};
12701279

confluent_kafka/src/Producer.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ static PyObject *Producer_flush (Handle *self, PyObject *args,
481481
return PyLong_FromLong(qlen);
482482
}
483483

484-
485484
static PyMethodDef Producer_methods[] = {
486485
{ "produce", (PyCFunction)Producer_produce,
487486
METH_VARARGS|METH_KEYWORDS,
@@ -546,6 +545,14 @@ static PyMethodDef Producer_methods[] = {
546545
"callbacks may be triggered.\n"
547546
"\n"
548547
},
548+
549+
{
550+
"list_topics",
551+
(PyCFunction)get_metadata,
552+
METH_VARARGS|METH_KEYWORDS,
553+
get_metadata_doc
554+
},
555+
549556
{ NULL }
550557
};
551558

confluent_kafka/src/confluent_kafka.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,17 @@ rd_kafka_conf_t *common_conf_setup (rd_kafka_type_t ktype,
268268
PyObject *kwargs);
269269
PyObject *c_parts_to_py (const rd_kafka_topic_partition_list_t *c_parts);
270270
rd_kafka_topic_partition_list_t *py_to_c_parts (PyObject *plist);
271+
PyObject *get_metadata(Handle *self, PyObject *args, PyObject *kwargs);
272+
273+
274+
extern const char get_metadata_doc[];
275+
271276

272277
#ifdef RD_KAFKA_V_HEADERS
273278
rd_kafka_headers_t *py_headers_to_c (PyObject *hdrs);
274279
PyObject *c_headers_to_py (rd_kafka_headers_t *headers);
275280
#endif
281+
276282
/****************************************************************************
277283
*
278284
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy