我有两个课程如下:
q = multiprocessing.Queue()
class Class1(object):
def __init__(self, device):
self.device = device
self.receiver = Class2(q).start()
class Class2(multiprocessing.Process):
def __init__(self, queue):
super(Class2, self).__init__()
self.queue = queue
def run(self):
"""This runs in a separate process."""
self.consumer = KafkaConsumer("my_topic")
while True:
for msg in self.consumer:
self.queue.put(msg)
2部分问题是 -