1---2name: eventstreams3description: Use when building real-time streaming pipelines in Microsoft Fabric with Eventstreams, connecting Event Hubs or IoT Hub sources, processing streams with windowed aggregations, or routing to Eventhouse/Lakehouse destinations. Covers DP-700 real-time intelligence domain.4---56# Eventstreams78## When to Use9- Ingesting real-time event data into Microsoft Fabric from Event Hubs, IoT Hub, or Kafka10- Building streaming pipelines with in-flight transformations (filter, aggregate, window)11- Routing streaming data to Eventhouse (KQL database) for real-time analytics12- Routing streaming data to Lakehouse for near-real-time Delta streaming13- Deciding between Eventstreams and Event Hubs for a streaming use case14- Preparing for Microsoft Fabric Data Engineer Associate (DP-700) exam1516## Core Jobs1718### 1. Eventstream Architecture19- **Eventstream** = Fabric-native no-code streaming service; visual canvas authoring20- Data flow: Source → (optional Transformations) → Destinations21- Eventstream runs continuously; no separate job to start/stop22- Fully managed; no Spark Structured Streaming setup required2324### 2. Event Sources25| Source | Description |26|--------|-------------|27| **Azure Event Hubs** | Most common; connect existing event hub namespace |28| **Azure IoT Hub** | Device telemetry from IoT scenarios |29| **Apache Kafka** | Kafka-compatible endpoint; use consumer group |30| **Sample data** | Built-in sample streams (e.g., Bicycles, Taxis) for testing |31| **Custom App** | Use Fabric SDK or Event Hubs SDK to publish events |32| **Azure SQL DB (CDC)** | Change data capture stream from SQL Server |33| **PostgreSQL (CDC)** | Change data capture stream from PostgreSQL |3435- Custom App source: connect using Event Hubs-compatible endpoint and SAS key or Managed Identity3637### 3. Stream Destinations38| Destination | Latency | Best for |39|-------------|---------|---------|40| **Eventhouse (KQL Database)** | Milliseconds | Real-time dashboards, KQL queries, alerts |41| **Lakehouse (Delta table)** | Seconds to minutes | Near-real-time; Delta streaming into medallion |42| **Reflex** | Near real-time | Event-driven alerts and automated actions |43| **Derived stream** | — | Fan-out to multiple downstream transformations |4445- **Eventhouse path**: lowest latency; query with KQL; best for operational dashboards46- **Lakehouse path**: higher latency (Delta micro-batch); best for analytical workloads that also need Spark4748### 4. Stream Transformations49Transformations applied in-flight before data reaches destination:50| Transformation | Description |51|----------------|-------------|52| **Filter** | Include/exclude events based on field conditions |53| **Manage fields** | Add, remove, rename, or change types of fields |54| **Aggregate** | Sum, Count, Min, Max, Avg over time window |55| **Group by** | Group aggregations by field values |56| **Union** | Merge multiple streams into one |57| **Expand** | Flatten nested JSON arrays |5859- **Time windows for aggregation**:60 - **Tumbling** — fixed, non-overlapping (e.g., 1-minute buckets)61 - **Sliding** — overlapping windows (e.g., last 5 minutes, updated every 1 minute)62 - **Session** — dynamic window based on activity gaps6364### 5. Eventhouse (KQL) Basics65- **Eventhouse** = KQL database optimized for real-time, time-series data in Fabric66- Auto-ingest from Eventstream: data lands in KQL table continuously67- Query with KQL (Kusto Query Language):68 ```kql69 // Count events per minute70 Events71 | where Timestamp > ago(1h)72 | summarize count() by bin(Timestamp, 1m)73 | render timechart7475 // Filter and project76 Events77 | where EventType == "click"78 | project UserId, Timestamp, Page79 ```80- KQL tables also queryable with T-SQL (limited subset)81- Real-time dashboards in Fabric connect directly to Eventhouse8283### 6. Eventstreams vs Event Hubs84| Aspect | Eventstreams | Azure Event Hubs |85|--------|-------------|-----------------|86| Scope | Fabric-native streaming pipeline | Standalone messaging service |87| Transformation | Built-in (no-code) | Requires Stream Analytics or Spark |88| Destinations | Fabric-native (Lakehouse, Eventhouse) | Any Azure service |89| Best for | Fabric-first analytics | Cross-service event distribution |9091- Use Eventstreams when your destination is Fabric (Lakehouse or Eventhouse)92- Use Event Hubs directly when distributing events to multiple non-Fabric consumers9394## Key Concepts95- **Eventhouse** — KQL database in Fabric; optimized for real-time time-series; auto-ingest from Eventstreams96- **KQL (Kusto Query Language)** — query language for Eventhouse; `| where`, `| summarize`, `| project`, `| render`97- **Tumbling window** — fixed non-overlapping time intervals for aggregation98- **CDC (Change Data Capture)** — stream database row changes (INSERT/UPDATE/DELETE) as events99- **Derived stream** — create multiple downstream branches from one source stream100- **Custom App source** — use Event Hubs-compatible SDK to push events to Eventstream101102## Checklist103- [ ] Eventhouse (KQL) chosen for millisecond-latency real-time queries?104- [ ] Lakehouse chosen when near-real-time is acceptable and Spark access needed later?105- [ ] In-flight transformations (filter, aggregate) configured before destination to reduce write volume?106- [ ] Time window type (tumbling/sliding/session) chosen based on aggregation requirement?107- [ ] Consumer group configured for Event Hubs/Kafka source (avoid sharing with other consumers)?108- [ ] Sample data source used for testing before connecting production Event Hub?109- [ ] Reflex configured for event-driven alerts on anomalous streaming data?110111## Output Format112- 🔴 **Critical** — routing high-frequency events directly to Lakehouse without aggregation (may cause write bottleneck)113- 🟡 **Warning** — using Lakehouse destination when millisecond latency is required (use Eventhouse instead)114- 🟡 **Warning** — no consumer group specified for Kafka/Event Hubs source (may conflict with other consumers)115- 🟢 **Suggestion** — add filter transformation to reduce event volume before Eventhouse ingestion116117## Exam Tips118- **Eventhouse = KQL database** — queryable with KQL (Kusto Query Language); also supports limited T-SQL119- **Eventstream → Eventhouse = real-time analytics path** — lowest latency (milliseconds); best for operational dashboards120- **Eventstream → Lakehouse = near-real-time** — Delta streaming; slightly higher latency; use when Spark access needed121- **KQL `summarize count() by bin(Timestamp, 1m)`** — standard pattern for 1-minute aggregation on time-series data122- **Custom App source = Event Hubs-compatible endpoint** — use Fabric SDK or Event Hubs SDK; send events using SAS or Managed Identity123- **Eventstream transformations happen in-flight** — no separate Spark Structured Streaming job needed; transformations run inside Eventstream before data hits destination