我正在尝试用pykafka创建一个简单的客户机。为此,我需要ssl证书。客户端在RHEL7和Python3.6.x下运行,看起来连接正常,但我没有得到任何反馈或数据,只有一个黑屏。如何检查连接或获取错误消息。
# !/usr/bin/scl enable rh-python36 -- python3
from pykafka import KafkaClient, SslConfig
config = SslConfig(cafile='key/root_ca.crt',
certfile='key/cert.crt',
keyfile='key/key.key',
password='xxxx')
client = KafkaClient(hosts="xxxxxxx:9093",
ssl_config=config)
print("topics", client.topics)
topic = client.topics['xxxxxx']
consumer = topic.get_simple_consumer(
consumer_group="yyyyy",
auto_offset_reset=OffsetType.EARLIEST,
reset_offset_on_start=False
)
for message in consumer:
if message is not None:
print (message.offset, message.value)
暂无答案!
目前还没有任何答案,快来回答吧!