问题
Does anyone know if there is a library that allows you to send a message to a specific partition on an IoT hub with Azure. I was previously able to achieve this with azuresblite library, unfortunatelly which I Cannot use. https://github.com/ppatierno/azuresblite
回答1:
There is no way to send a message to a specific partition. Period. Partitions are used internally to allow scaling of the IoT (Event Hub) and allow for scaling out the consumer app (the one that reads the events out of the Hub).
While you can specify a Partition Key when using Event Hub, this does identify a Partition ID. And using IoT Hub, the option to specify Partition Key is anyway hidden and you cannot influence it. Specifying a Partition Key for a message in Event Hub will just make sure that all messages with the same partition key will fall into the same partition. But you cannot tell which partition (0,1,2..n). I have seen projects which try to literary abuse the Partitions and use them as "tenants". Very wrong way of completely abusing scalability of Event Hubs.
Please do not abuse the partitioning of Event Hub (which is anyway the back-end system for an IoT Hub). Do not force Partition Keys. Thus you are unbalancing the Event Hub and may go into a wrong direction. Instead please clearly define a technical issue you are trying to solve and we may be able to help you.
来源:https://stackoverflow.com/questions/43076839/sending-message-to-azure-iot-hub-partition