Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
chetanhiwale
Advocate II
Advocate II

Spark streaming using Eventstream custom endpoint (Azure Event Hub)

I have created a Eventstream and using a custom endpoint as a source. Here my source is Azure Event hub. I am trying to read the data using spark streaming in Fabric notebook. Although I am able to start the spark stream, but not able to read any data. Is there setting enabled for custom endpoint like it can only listen to events. 

Event stream:

chetanhiwale_0-1745307664864.png

chetanhiwale_1-1745307692887.png


Pyspark code: 

from pyspark.sql import SparkSession
from pyspark.sql.functions import from_json, col
from pyspark.sql.types import StructType, StructField, StringType, IntegerType


# Event Hub connection string
event_hub_connection_string = "<Endpoint>"
 
# Read data from Event Hub
df = spark.readStream.format("eventhubs")\
  .options(**ehConf)\
  .load()  

rawData = df\
  .withColumn("bodyAsString", f.col("body").cast("string"))\
  .writeStream\
  .format("delta")\
  .option("checkpointLocation", "Files/checkpoint/stocks")\
  .outputMode("append")\
  .option("path", 'Tables/stock_events')

handler = rawData.start()
1 ACCEPTED SOLUTION
v-prasare
Community Support
Community Support

Hi @chetanhiwale,

Thanks for reaching out MS Fabric communnity support

custom endpoints in Eventstream are output-only, not sources. You cannot use Eventstream to feed Spark as a source. You either:

  • Connect Spark directly to Event Hub (bypass Eventstream)

  • Let Eventstream output to a Lakehouse or Delta, and Spark reads from that

 

Thanks,

Prashanth Are

View solution in original post

2 REPLIES 2
v-prasare
Community Support
Community Support

Hi @chetanhiwale,

Thanks for reaching out MS Fabric communnity support

custom endpoints in Eventstream are output-only, not sources. You cannot use Eventstream to feed Spark as a source. You either:

  • Connect Spark directly to Event Hub (bypass Eventstream)

  • Let Eventstream output to a Lakehouse or Delta, and Spark reads from that

 

Thanks,

Prashanth Are

chetanhiwale
Advocate II
Advocate II

Thanks @v-prasare for sharing !!

 

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Weeks

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)