我嘗試從具有「EventHubReceiver」(Device2Cloud)的設備接收消息。每個設備應該有它自己的單個接收器。
那麼是不是所有的設備創建(每個分區)一個單一EventHubReceiver一個問題:Azure IoT Hub - 使用多個EventHub接收器接收來自不同設備的事件
string iotHubconnectionString = CloudConfigurationManager.GetSetting("Microsoft.IotHub.ConnectionStringPayed");
string iotHubD2cEndpoint = "messages/events";
EventHubClient eventHubClient = EventHubClient.CreateFromConnectionString(iotHubconnectionString, iotHubD2cEndpoint);
EventHubRuntimeInformation runtimeInformation = eventHubClient.GetRuntimeInformation();
如果我當時想從我做以下步驟客戶端接收郵件:
EventHubReceiver eventHubReceiver = eventHubClient2.GetDefaultConsumerGroup().CreateReceiver(partition); //Get the partitions via the runtimeInformation: string[] partitions = runtimeInformation.PartitionIds;
var incommingMessage = eventHubReceiver.ReceiveAsync(); //Wait here for incomming messages
工作正常,但是所有「設備」中的所有消息都到達此「EventHubReceiver」。我想有多個接收器,只接收來自單個設備的消息。
我試圖更改以下代碼行:
string iotHubD2cEndpoint = "messages/events";
到
string iotHubD2cEndpoint = "devices/{deviceID}/messages/events";
但不起作用沒事。我得到以下錯誤:
The link address 'devices/secondDevice/messages/events/$management' did not match any of the expected formats. Supported formats: '/$cbs', '/devices/{deviceid}/messages/events', '/devices/{deviceid}/messages/deviceBound', '/messages/deviceBound', '/messages/serviceBound/feedback', '/messages/events/*'.
所以問題是,我得到'devices/secondDevice/messages/events/$management'
insted的的'devices/secondDevice/messages/events/'
我不知道,它是否僅僅是不可能爲每個設備或我一個EventHubReceiver代碼或思想中有錯誤。
他,你喜歡回答我的問題:D ... – Franklin84
我已經回答了其他任何問題嗎?太好了! :-)你覺得最後一個有用嗎? – ppatierno
只是幾天前:http://stackoverflow.com/questions/33689947/azure-iot-hub-feedbackreceiver-receiveasync-is-very-slow-15-seconds-high-laten – Franklin84