Apache spark 从Azure Eventhub读取火花=>;StreamingQueryException:输入字节数组具有错误的4字节结束单位

Apache spark 从Azure Eventhub读取火花=>;StreamingQueryException:输入字节数组具有错误的4字节结束单位,apache-spark,pyspark,azure-eventhub,Apache Spark,Pyspark,Azure Eventhub,我正在尝试使用Spark/Python收集Azure Eventhub消息。 每次,我都会遇到异常“StreamingQueryException:输入字节数组有错误的4字节结束单位” 有什么想法吗 conf = {} conf["eventhubs.connectionString"] = "Endpoint=sb://XXXXXXXXX.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAcc

我正在尝试使用Spark/Python收集Azure Eventhub消息。 每次,我都会遇到异常“StreamingQueryException:输入字节数组有错误的4字节结束单位”

有什么想法吗

conf = {}
conf["eventhubs.connectionString"] = "Endpoint=sb://XXXXXXXXX.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXXXXXXXXXXXX=;EntityPath=XXXXXX"
                                      
read_df  = spark.readStream.format("eventhubs").options(**conf).load()
stream = read_df.writeStream.format("console").start()
stream.awaitTermination()

请注意,对于2.3.15及更高版本,您需要加密配置字典中的连接字符串:

ehConf['eventhubs.connectionString'] = sc._jvm.org.apache.spark.eventhubs.EventHubsUtils.encrypt(connectionString)

您好,欢迎来到SO。你能提供更多的信息让其他人复制你的问题吗?请分享你如何构建你的SparkConf,你的sbt(或者你正在使用的任何构建工具)文件,等等,这些都会对贡献者有所帮助。有关如何制作最小可复制示例的更多详细信息,请参阅。感谢您的回复。我使用的版本是Spark 3.0.1/com.microsoft.azure:azure-eventhubs-Spark_2.12:2.3.17会话初始化为Spark=SparkSession.builder.appName(“teststream”)Spark=Spark.config(“Spark.jars.packages”,“com.microsoft.azure:azure-eventhubs-Spark_2.12:2.3.17”)Spark=Spark.getOrCreate()