简体   繁体   English

使用事件中心将数据流式传输到Azure Databricks

[英]Stream data into Azure Databricks using Event Hubs

I want to send messages from a Twitter application to an Azure event hub. 我想将消息从Twitter应用程序发送到Azure事件中心。 However, I am getting the an error that says instead of java.util.concurrent.ExecutorService use java.util.concurrent.ScheduledExecutorService . 但是,我得到一个错误,指出不是java.util.concurrent.ExecutorService使用java.util.concurrent.ScheduledExecutorService

I do not know how to create the EventHubClient.create now. 我不知道如何立即创建EventHubClient.create。 Please help. 请帮忙。

I am referring to code from the link 我指的是链接中的代码

https://docs.microsoft.com/en-us/azure/azure-databricks/databricks-stream-from-eventhubs https://docs.microsoft.com/en-us/azure/azure-databricks/databricks-stream-from-eventhubs

This is error I am getting: 这是我得到的错误:

notebook:15: error: type mismatch; 笔记本15:错误:类型不匹配; found : java.util.concurrent.ExecutorService required: java.util.concurrent.ScheduledExecutorService 找到: java.util.concurrent.ExecutorService必需: java.util.concurrent.ScheduledExecutorService

 val pool = `Executors.newFixedThreadPool(1)` val eventHubClient = EventHubClient.create(connStr.toString(), pool) 

Here is my code, 这是我的代码,

import java.util._
import scala.collection.JavaConverters._
import com.microsoft.azure.eventhubs._
import java.util.concurrent.{Executors, ExecutorService}

val pool: ExecutorService = Executors.newFixedThreadPool(1)
val eventHubClient = EventHubClient.create(connStr.toString(), pool)

Create a library in your Databricks workspace using the Maven coordinates com.microsoft.azure:azure-eventhubs-spark_2.11:2.3.2 or higher version. 使用Maven坐标com.microsoft.azure:azure-eventhubs-spark_2.11:2.3.2或更高版本在Databricks工作区中创建库。 Attach the created library to your cluster and re-attach the notebook to your cluster after it. 将创建的库连接到群集,然后将笔记本重新连接到群集。

import java.util._
import scala.collection.JavaConverters._
import com.microsoft.azure.eventhubs._
import java.util.concurrent._
//Set up Connection to Azure Event Hubs
val namespaceName = "namespaceName_of_event_hub"
val eventHubName = "Name_of_event_hub"
val sasKeyName = "your_Sas_key_name"
val sasKey = "xxxxxxxxxxxxxxxxxxxxxxx"
val connStr = new ConnectionStringBuilder()
            .setNamespaceName(namespaceName)
            .setEventHubName(eventHubName)
            .setSasKeyName(sasKeyName)
            .setSasKey(sasKey)
val pool = Executors.newFixedThreadPool(1)
val eventHubClient = EventHubClient.create(connStr.toString(), pool)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 事件中心与Azure Databricks的连接 - Connection of Event hubs to Azure Databricks 如何将数据从Azure SQL流传输到Azure Blob /事件中心? - How to stream data from Azure SQL to Azure Blob/Event Hubs? 创建一个从AZURE读取数据的nodejs Web应用程序。 (流分析或事件中心或日志分析) - Create a nodejs web app that reads data from AZURE. (Stream analytics or Event Hubs or Log analytics) 事件中心的 Azure 数据资源管理器检查点 - Azure Data Explorer Checkpoint for Event Hubs 将JSON数据路由到Azure中的事件中心 - Routing JSON data to Event Hubs in Azure 将Azure事件中心与Data Lake Store连接 - Connect Azure Event Hubs with Data Lake Store 使用Azure事件中心的Spark Streaming - Spark Streaming using Azure Event Hubs 尝试将 Azure Databricks 与 Azure 事件中心连接,以将一些属性发送到事件中心并通过 splunk 读取 - Trying to connect Azure Databricks with Azure Event hubs to send some properties to event hub and read it through splunk 如何使用流分析作业再次处理 Azure 事件中心中的事件? - How to process again events in Azure Event Hubs with Stream Analytics job? 如何在 Spring 云 Stream 中使用 2 个 Azure 事件中心 - How to consume 2 Azure Event Hubs in Spring Cloud Stream
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM