Question 50
DP-750 voucher + Udemy course (lifetime access) = ₹3,500 for Indian ID card holders.
Details →Your organization streams telemetry into an **Azure Event Hubs** namespace and you must ingest it into a Unity Catalog Delta table on Azure Databricks using Structured Streaming. The Event Hubs namespace exposes the Kafka-compatible endpoint on port `9093`, and you will authenticate with SASL/SSL using the namespace connection string. You write the following PySpark code: ```python EH_NAMESPACE = "myns.servicebus.windows.net:9093" CONN_STR = dbutils.secrets.get("eh", "connstr") EH_SASL = (f'kafkashaded.org.apache.kafka.common.security.plain.PlainLoginModule ' f'required username="$ConnectionString" password="{CONN_STR}";') df = (spark.readStream .format("kafka") .option("kafka.bootstrap.servers", EH_NAMESPACE) .option("subscribe", "telemetry") .option("kafka.security.protocol", "SASL_SSL") .option("kafka.sasl.mechanism", "PLAIN") .option("kafka.sasl.jaas.config", EH_SASL) .option("startingOffsets", "latest") .load()) ``` Which statement is correct about ingesting Azure Event Hubs data this way?
- AAzure Event Hubs cannot be read by the Spark Kafka connector; you must install the third-party Azure Event Hubs Spark connector JVM library and use `.format("eventhubs")`.
- BBecause Event Hubs exposes a **Kafka-compatible endpoint**, the built-in Spark Structured Streaming **Kafka connector** can read it using `.format("kafka")` with `kafka.bootstrap.servers` set to the namespace `:9093`, the topic in `subscribe`, and SASL_SSL/PLAIN authentication; the returned `key`/`value` are binary and must be cast.
- CThe `subscribe` and `security.protocol` options must be prefixed with `eventhubs.` instead of `kafka.` for Event Hubs to work.
- DStructured Streaming reads from Kafka/Event Hubs return rows already parsed into the source schema, so no casting of the `value` column is required.