2 min read
Real-Time Data Processing with Microsoft Fabric Eventstreams
Microsoft Fabric’s Eventstreams provide a no-code interface for building real-time data pipelines. By capturing, transforming, and routing streaming data, Eventstreams connect your event sources to analytics destinations.
Creating an Eventstream
Eventstreams support multiple source types including Azure Event Hubs, Azure IoT Hub, and custom applications. The visual designer makes it easy to configure transformations without writing code.
Processing Events with KQL
Once events reach an Eventhouse, use Kusto Query Language (KQL) for real-time analytics.
// Real-time aggregation of IoT sensor data
SensorEvents
| where ingestion_time() > ago(5m)
| summarize
AvgTemperature = avg(temperature),
MaxTemperature = max(temperature),
MinTemperature = min(temperature),
ReadingCount = count()
by bin(timestamp, 1m), device_id
| order by timestamp desc
// Anomaly detection using series analysis
SensorEvents
| where timestamp > ago(1h)
| make-series AvgTemp = avg(temperature) on timestamp step 1m by device_id
| extend anomalies = series_decompose_anomalies(AvgTemp)
| mv-expand timestamp, AvgTemp, anomalies
| where anomalies > 1.5
| project timestamp, device_id, AvgTemp, AnomalyScore = anomalies
Configuring Destinations
# Python SDK for sending events to Eventstream
from azure.eventhub import EventHubProducerClient, EventData
import json
producer = EventHubProducerClient.from_connection_string(
conn_str=connection_string,
eventhub_name=eventhub_name
)
async def send_telemetry(device_id: str, readings: dict):
event_data = EventData(json.dumps({
"device_id": device_id,
"timestamp": datetime.utcnow().isoformat(),
**readings
}))
async with producer:
batch = await producer.create_batch()
batch.add(event_data)
await producer.send_batch(batch)
Real-Time Dashboards
Connect Eventstreams to Power BI for live dashboards that update as events flow through the system. The combination of Eventstreams, Eventhouse, and Power BI creates a complete real-time analytics solution within Fabric.