please refer to DeepStream sample deepstream-test5, which already support sending messages to kafka and receiving messages from kafka. for example, \opt\nvidia\deepstream\deepstream\sources\apps\sample_apps\deepstream-test5\configs\test5_config_file_src_infer.txt
deeptream-test4 already supports sending data to kafka. About receiving data from kafka, I suggest reading the logics in start_cloud_to_device_messaging of opt\nvidia\deepstream\deepstream\sources\apps\apps-common\src\deepstream_c2d_msg.c first, then use python bindings to port the necessary functions to python, such as nv_msgbroker_connect and nv_msgbroker_subscribe. please refer to nvds_measure_buffer_latency for a sample.
There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks