Kafka Consumer Hanging

I’m attempting to use Apache Kafka to create a KafkaConsumer in Python. I’m running the following code in a Text DAT, but when I run the script TD hangs indefinitely.

[code]from kafka import KafkaConsumer

consumer = KafkaConsumer(‘checkout’,bootstrap_servers=[‘SERVER:PORT’],security_protocol=‘SSL’,ssl_cafile=‘/etc/ssl/cert.pem’,ssl_certfile=‘kafka.cert’,ssl_keyfile=‘kafka.key’)

for msg in consumer:
op(‘trigger1’).par.triggerpulse.pulse()
[/code]

When I run the script in an external Python application the Consumer takes 5 seconds to load, then the events start pouring in. I’m thinking this needs to be run in a thread, but in this particular case the thread doesn’t end, it streams events till the script is killed. Is my thinking correct or is there a better way to build this? If threading is the way to go, I’m assuming I need to output to a Queue?

As a workaround I’m running the Kafka Consumer in an external Python script and emitting a TCP Socket byte for every received event to a TCP-IP DAT. With TD hanging, I can’t see the logs to determine if there’s an incorrect path to a module.

Using Experimental Build 2019.30550.

I might still consider launching a python thread and communicating back with TouchDesigner through python queues.

For more information and example, see this thread:

viewtopic.php?f=4&t=5396&p=19871

Cheers,
Rob