@@ -138,7 +138,7 @@ Admin_options_to_c (Handle *self, rd_kafka_admin_op_t for_api,
138138 char errstr [512 ];
139139
140140 if (!self -> rk ) {
141- PyErr_SetString (PyExc_RuntimeError , "AdminClient has been closed" );
141+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
142142 return NULL ;
143143 }
144144
@@ -578,6 +578,11 @@ static PyObject *Admin_create_topics (Handle *self, PyObject *args,
578578 & options .validate_only ))
579579 return NULL ;
580580
581+ if (!self -> rk ) {
582+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
583+ return NULL ;
584+ }
585+
581586 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_CREATETOPICS ,
582587 & options , future );
583588 if (!c_options )
@@ -721,6 +726,11 @@ static PyObject *Admin_delete_topics (Handle *self, PyObject *args,
721726 return NULL ;
722727 }
723728
729+ if (!self -> rk ) {
730+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
731+ return NULL ;
732+ }
733+
724734 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DELETETOPICS ,
725735 & options , future );
726736 if (!c_options )
@@ -831,6 +841,11 @@ static PyObject *Admin_create_partitions (Handle *self, PyObject *args,
831841 & options .validate_only ))
832842 return NULL ;
833843
844+ if (!self -> rk ) {
845+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
846+ return NULL ;
847+ }
848+
834849 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_CREATEPARTITIONS ,
835850 & options , future );
836851 if (!c_options )
@@ -952,6 +967,11 @@ static PyObject *Admin_describe_configs (Handle *self, PyObject *args,
952967 return NULL ;
953968 }
954969
970+ if (!self -> rk ) {
971+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
972+ return NULL ;
973+ }
974+
955975 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DESCRIBECONFIGS ,
956976 & options , future );
957977 if (!c_options )
@@ -1085,6 +1105,12 @@ static PyObject *Admin_incremental_alter_configs(Handle *self,PyObject *args,PyO
10851105 !cfl_PyBool_get (validate_only_obj , "validate_only" ,
10861106 & options .validate_only ))
10871107 return NULL ;
1108+
1109+ if (!self -> rk ) {
1110+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
1111+ return NULL ;
1112+ }
1113+
10881114 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_INCREMENTALALTERCONFIGS ,
10891115 & options , future );
10901116 if (!c_options )
@@ -1252,6 +1278,11 @@ static PyObject *Admin_alter_configs (Handle *self, PyObject *args,
12521278 & options .validate_only ))
12531279 return NULL ;
12541280
1281+ if (!self -> rk ) {
1282+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
1283+ return NULL ;
1284+ }
1285+
12551286 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_ALTERCONFIGS ,
12561287 & options , future );
12571288 if (!c_options )
@@ -1409,6 +1440,11 @@ static PyObject *Admin_create_acls (Handle *self, PyObject *args, PyObject *kwar
14091440 goto err ;
14101441 }
14111442
1443+ if (!self -> rk ) {
1444+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
1445+ goto err ;
1446+ }
1447+
14121448 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_CREATEACLS ,
14131449 & options , future );
14141450 if (!c_options )
@@ -1528,6 +1564,11 @@ static PyObject *Admin_describe_acls (Handle *self, PyObject *args, PyObject *kw
15281564 goto err ;
15291565 }
15301566
1567+ if (!self -> rk ) {
1568+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
1569+ goto err ;
1570+ }
1571+
15311572 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_CREATEACLS ,
15321573 & options , future );
15331574 if (!c_options )
@@ -1640,6 +1681,11 @@ static PyObject *Admin_delete_acls (Handle *self, PyObject *args, PyObject *kwar
16401681 goto err ;
16411682 }
16421683
1684+ if (!self -> rk ) {
1685+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
1686+ goto err ;
1687+ }
1688+
16431689 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DELETEACLS ,
16441690 & options , future );
16451691 if (!c_options )
@@ -1804,6 +1850,11 @@ PyObject *Admin_list_consumer_groups (Handle *self, PyObject *args, PyObject *kw
18041850 }
18051851 }
18061852
1853+ if (!self -> rk ) {
1854+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
1855+ goto err ;
1856+ }
1857+
18071858 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_LISTCONSUMERGROUPS ,
18081859 & options , future );
18091860 if (!c_options ) {
@@ -1890,6 +1941,11 @@ static PyObject *Admin_describe_user_scram_credentials(Handle *self, PyObject *a
18901941 return NULL ;
18911942 }
18921943
1944+ if (!self -> rk ) {
1945+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
1946+ return NULL ;
1947+ }
1948+
18931949 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DESCRIBEUSERSCRAMCREDENTIALS ,
18941950 & options , future );
18951951 if (!c_options )
@@ -2054,6 +2110,11 @@ static PyObject *Admin_alter_user_scram_credentials(Handle *self, PyObject *args
20542110 goto err ;
20552111 }
20562112
2113+ if (!self -> rk ) {
2114+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
2115+ goto err ;
2116+ }
2117+
20572118 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_ALTERUSERSCRAMCREDENTIALS ,
20582119 & options , future );
20592120 if (!c_options )
@@ -2303,6 +2364,11 @@ PyObject *Admin_describe_consumer_groups (Handle *self, PyObject *args, PyObject
23032364 Py_XDECREF (uogroup );
23042365 }
23052366
2367+ if (!self -> rk ) {
2368+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
2369+ goto err ;
2370+ }
2371+
23062372 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DESCRIBECONSUMERGROUPS ,
23072373 & options , future );
23082374 if (!c_options ) {
@@ -2426,6 +2492,11 @@ PyObject *Admin_describe_topics (Handle *self, PyObject *args, PyObject *kwargs)
24262492 }
24272493 }
24282494
2495+ if (!self -> rk ) {
2496+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
2497+ goto err ;
2498+ }
2499+
24292500 c_topic_collection = rd_kafka_TopicCollection_of_topic_names (c_topics , topics_cnt );
24302501 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DESCRIBETOPICS ,
24312502 & options , future );
@@ -2514,6 +2585,11 @@ PyObject *Admin_describe_cluster (Handle *self, PyObject *args, PyObject *kwargs
25142585 & options .include_authorized_operations ))
25152586 goto err ;
25162587
2588+ if (!self -> rk ) {
2589+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
2590+ goto err ;
2591+ }
2592+
25172593 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DESCRIBECLUSTER ,
25182594 & options , future );
25192595 if (!c_options ) {
@@ -2586,6 +2662,11 @@ PyObject *Admin_delete_consumer_groups (Handle *self, PyObject *args, PyObject *
25862662 goto err ;
25872663 }
25882664
2665+ if (!self -> rk ) {
2666+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
2667+ goto err ;
2668+ }
2669+
25892670 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DELETEGROUPS ,
25902671 & options , future );
25912672 if (!c_options ) {
@@ -2702,6 +2783,11 @@ PyObject *Admin_list_consumer_group_offsets (Handle *self, PyObject *args, PyObj
27022783 & options .require_stable_offsets ))
27032784 return NULL ;
27042785
2786+ if (!self -> rk ) {
2787+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
2788+ goto err ;
2789+ }
2790+
27052791 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_LISTCONSUMERGROUPOFFSETS ,
27062792 & options , future );
27072793 if (!c_options ) {
@@ -2841,6 +2927,11 @@ PyObject *Admin_alter_consumer_group_offsets (Handle *self, PyObject *args, PyOb
28412927 goto err ;
28422928 }
28432929
2930+ if (!self -> rk ) {
2931+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
2932+ goto err ;
2933+ }
2934+
28442935 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_ALTERCONSUMERGROUPOFFSETS ,
28452936 & options , future );
28462937 if (!c_options ) {
@@ -2972,6 +3063,11 @@ PyObject *Admin_list_offsets (Handle *self,PyObject *args, PyObject *kwargs) {
29723063 goto err ;
29733064 }
29743065
3066+ if (!self -> rk ) {
3067+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
3068+ goto err ;
3069+ }
3070+
29753071 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_LISTOFFSETS ,
29763072 & options , future );
29773073 if (!c_options ) {
@@ -3054,6 +3150,11 @@ PyObject* Admin_delete_records (Handle *self,PyObject *args,PyObject *kwargs){
30543150 goto err ;
30553151 }
30563152
3153+ if (!self -> rk ) {
3154+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
3155+ goto err ;
3156+ }
3157+
30573158 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_DELETERECORDS ,
30583159 & options , future );
30593160 if (!c_options ) {
@@ -3148,6 +3249,11 @@ PyObject *Admin_elect_leaders(Handle *self, PyObject *args, PyObject *kwargs) {
31483249 goto err ;
31493250 }
31503251
3252+ if (!self -> rk ) {
3253+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
3254+ goto err ;
3255+ }
3256+
31513257 c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_ELECTLEADERS ,
31523258 & options , future );
31533259 if (!c_options ) {
@@ -3251,7 +3357,7 @@ static PyObject *Admin_poll (Handle *self, PyObject *args,
32513357 return NULL ;
32523358
32533359 if (!self -> rk ) {
3254- PyErr_SetString (PyExc_RuntimeError , "AdminClient has been closed" );
3360+ PyErr_SetString (PyExc_RuntimeError , ERR_MSG_ADMIN_CLIENT_CLOSED );
32553361 return NULL ;
32563362 }
32573363
0 commit comments