Apache Spark 流连接字符串错误与 Databricks 连接到 Azure 事件中心

Apache Spark Streaming Connection String error with Databricks connection to Azure Event Hub

我遇到错误:

Exception: ERROR: 'int' object has no attribute 'value'
AttributeError: 'str' object has no attribute '_jvm'
ehConf['eventhubs.connectionString'] = self.connectionProperties.sc._jvm.org.apache.spark.eventhubs.EventHubsUtils.encrypt(connectionString)

当我尝试调用以下函数时:

def EventHubConnectionProperties(self,processId,startOffset,endTime):
        ehConf = {}
        ehConf['eventhubs.connectionString'] = self.connectionProperties.sc._jvm.org.apache.spark.eventhubs.EventHubsUtils.encrypt(connectionString)

有没有人有什么想法?

应该如下使用-

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