I need to process messages from IoT devices and so far I have been fine with my workflow (IoT device sends message to IoT Hub and IoT Hub triggered Azure Function processes the message and saves the information into Azure SQL). But now I have a device which sends the whole information in two separate messages in a row (because of the length of information). Is there any solution on how to handle these two separate message at once? (Each message type has a unique ID so I would know which message is the first part of the information and which is second)
1 Answers
Is it an option to upload it as a file to blob storage assigned to IoT Hub, and by using DeviceClient method UploadBlobAsync? That way you can have azure function attached when new file shows up in blob storage container. That could be one way.
If you do not like the file upload solution, you have to consider that Azure functions are stateless, and if you need to merge two messages to get one information on the cloud side, you would need to save the state somewhere and check from there.
Also, reliability here would be also something to consider before deciding if the AF are the right service for stream processing in this particular case. For example: could it be the case that the first message comes, and connection breaks before the second message come to IoT Hub. And can you be sure that messages will always come in order?