Ingesting streams from Azure Event Hubs
Azure Databricks ingests streaming data from Azure Event Hubs using Spark Structured Streaming, either via the native Event Hubs connector or the Kafka-compatible endpoint since Event Hubs implements the Kafka protocol. The connection is configured through a readStream source with connection details (namespace, entity path, and credentials) supplied as options, and the resulting DataFrame is processed like any other streaming source.
1 · Learn the must-know
- Use
spark.readStream.format("eventhubs")with the azure-eventhubs-spark connector, orformat("kafka")pointing at the Event Hubs Kafka endpoint (port 9093) since Event Hubs is Kafka-protocol compatible. - Event Hubs connection strings must be encrypted with
EventHubsUtils.encrypt()before being placed in the EventHubsConf, and should be retrieved from a Databricks secret scope (backed by Azure Key Vault or Databricks-managed) rather than hardcoded. - A checkpoint location (typically on DBFS or ADLS) is required for the streaming query to track consumed offsets and enable fault-tolerant, exactly-once processing on restart.
- The number of Event Hubs partitions caps the maximum parallelism of the Structured Streaming job, so partition count should be sized to the desired throughput.
- Use
maxEventsPerTrigger(ormaxOffsetsPerTriggerfor the Kafka connector) to control micro-batch size and prevent overwhelming the cluster with backlog data. - Consumer groups in Event Hubs should be dedicated per Databricks streaming application to avoid throttling or offset conflicts with other consumers reading the same event hub.
2 · Check your understanding
A team ingests telemetry from an IoT solution into an Event Hub. In an Azure Databricks notebook, they want to use the native Azure Databricks Structured Streaming connector for Event Hubs (not the Kafka-compatible endpoint) to continuously read the data into a DataFrame, using an EventHubsConf options map named ehConf. Which code correctly initializes the streaming read?
What you have tried across DP-750's objectives, not a readiness score.
Set up and configure an Azure Databricks environment15-20% of the exam0 of 13 tried
Secure and govern Unity Catalog objects15-20% of the exam0 of 12 tried
Prepare and process data30-35% of the exam0 of 28 tried
Deploy and maintain data pipelines and workloads30-35% of the exam0 of 24 tried
3 · Keep going
Ready for more? Take a weighted mock or try free practice questions.