首页 > 解决方案 > 创建 Key_Shared Consumer Apache Pulsar

问题描述

我使用 Apache Pulsar Python 客户端连接我的微服务。我想创建 Key_Shared Consumer 这样做:

import pulsar,_pulsar                

client = pulsar.Client('pulsar://localhost:6650')
consumer = client.subscribe('my-topic', 'consume-id',
             consumer_type=_pulsar.ConsumerType.KeyShared)

但我收到以下错误:

AttributeError: type object 'ConsumerType' has no attribute 'KeyShared'

KeyShared 是否已在 Python 客户端中实现?如果是,我该如何使用它?

标签: pythonapache-pulsarpython-pulsar

解决方案


它在 Python 客户端的 2.4.2 中发布。


推荐阅读