From 9b78874c6ce98d24ff1d6d68a7157c899d5c9c66 Mon Sep 17 00:00:00 2001 From: Peter da Silva Date: Tue, 11 Sep 2018 15:43:34 +0000 Subject: [PATCH] Check for failure of rd_kafka_poll_set_consumer() --- generic/kafkatcl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/generic/kafkatcl.c b/generic/kafkatcl.c index 7be2f16..0e6eaca 100644 --- a/generic/kafkatcl.c +++ b/generic/kafkatcl.c @@ -4386,8 +4386,12 @@ kafkatcl_createSubscriberObjectCommand (kafkatcl_objectClientData *ko, char *cmd return TCL_ERROR; } - // Need to do this OR call rd_kafka_poll() periodically. - rd_kafka_poll_set_consumer(rk); + // After this do not call rd_kafka_poll(), call rd_kafka_consumer_poll() instead + if(rd_kafka_poll_set_consumer(rk) != RD_KAFKA_RESP_ERR_NO_ERROR) { + // Only possible error is RD_KAFKA_RESP_ERR__UNKNOWN_GROUP + Tcl_SetObjResult (interp, Tcl_NewStringObj("Unexpected failure from rd_kafka_poll_set_consumer", -1)); + return TCL_ERROR; + } // finished kafka setup, save state