【发布时间】:2016-05-28 05:24:34
【问题描述】:
我尝试通过 Python 从 Azure EventHub 接收消息,但遗憾的是我无法订阅它。
我的脚本基于https://gist.github.com/tomconte/e2a4667185a9bf674f59 并且已经在python script which subscribes/listens to Azure Event Hub? 中提出了另一个类似的问题,不幸的是没有解决它。
到我的设置: Python 2.7.9 (Ubuntu 15.04)
通过 pip 安装 qpid-proton:
pip show python-qpid-proton
...
Version: 0.11.1
...
所以我正在尝试以下方法:
from proton import *
import urllib
key = urllib.quote(FOOBAR,"")
address = "amqps://name:" + key + "@nsname.servicebus.windows.net/eventhubname/ConsumerGroups/$Default/Partitions/0"
messenger = Messenger()
messenger.subscribe(address)
proton.MessengerException: Cannot subscribe to [ADDRESS]
name/key 应该没问题,因为它可以在另一个应用程序中使用。
有什么猜测吗?
【问题讨论】:
-
嗨,似乎没有必要对密钥进行编码。请尝试使用 Azure 门户中的原始密钥。任何结果,请告诉我。
-
感谢您的回复。尝试不编码密钥但也失败了。在我的密钥中有一个“/”导致连接失败:
proton.MessengerException: [-2]: CONNECTION ERROR (name:KeyUntilSlash): getaddrinfo(name, KeyUntilSlash): Servname not supported for ai_socktype其中 KeyuntilSlash 是密钥的第一部分,不包括“/”
标签: python azure amqp qpid azure-eventhub