7

我想閱讀來自服務總線的訂閱消息。我正在使用python的qpid-proton庫。我正在關注此鏈接以接收消息Proton-Python-Example-Simple-Receive。我通過這個鏈接直接從服務總線接收消息 -qpid質子url用於接收來自給定訂閱(主題)的消息

url = 'amqps://mynamespace.servicebus.windows.net/SharedAccessKeyName=xxxx/SharedAccessKey=xxxxxxxxx/python-test/Subscriptions/AllMessages' 
# python-test is the name of the topic 
# AllMessages is the name of the subscription 

我收到以下錯誤 - ERROR:root:The messaging entity 'sb://mynamespace.servicebus.windows.net/sharedaccesskeyname=xxxxx/sharedaccesskey=xxxxxxxxxxxxx/python-test/subscriptions/allmessages' could not be found. TrackingId:c1e4a39edbd44040b2fd48a552d6ae2b_G2, SystemTracker:gateway6, Timestamp:7/19/2017 7:58:51 AM

這是由於事實,即上面的URL格式不正確。我在網上搜索過,沒有提供適當的文件。什麼是通過qpid讀取訂閱消息的正確URL格式。

任何幫助將深表謝意。

非常感謝。

回答

0

請嘗試更改您的網址,如下所示。

amqps://<SAS Policy Name>:<SharedAccessKey>@mynamespace.servicebus.windows.net/python-test/Subscriptions/AllMessages

enter image description here

+0

我實際的URL是 'amqps://所有:Dj8/[email protected]/job/Subscriptions/Create'。它會拋出一個錯誤「ValueError:不是有效的端口號或服務名稱:'Dj8'」。我認爲它與我的共享訪問密鑰有關,因爲它包含「/」字符 –

+0

@AuuragSharma請重新生成您的共享訪問密鑰,而不用'/'符號重試。根據我的經驗,我認爲這個問題是由amqp url解析器無法正確解析URL導致的。 –

+0

PaterPan - 我現在收到此錯誤 - 執行此操作需要「收聽」聲明。 –

相關問題