Paolo Salvatori created an example that simulates an Internet of Things (IoT) scenario where thousands of devices send events (e.g. sensor readings) to a backend system via a message broker. The backend system retrieves events from the messaging infrastructure and store them to a persistent repository in a scalable manner. Solution has the following components:
- Event Hub to collect messages
- Service Fabric to move messages from Event Hub into Azure SQL Database in JSON format
- Azure Sql Database where JSON messages are parsed using OPENJSON function and stored messages
The architecture is shown on the following figure:
Device simulator sends messages to Event Hub, and Service Fabric service reads messages as JSON and stores them into Azure SQL Database. Messages are sent in JSON format so they are parsed in database using OPENJSON function and stored into Events table.
Source code is available on GitHub: