简体   繁体   English

我们如何在没有存储容器名称、StorageAccountName 和 StorageAccountKey 这些信息的情况下从 Azure 事件中心接收事件

[英]How We can receive event from Azure event hub without Storage Container Name ,StorageAccountName and StorageAccountKey these information

I am new to Azure platform, I have only EventHubConnectionString and EventHubName and I don't have Storage Container Name, StorageAccountName and storage account key.我是 Azure 平台的新手,我只有 EventHubConnectionString 和 EventHubName,我没有存储容器名称、StorageAccountName 和存储帐户密钥。 I want to develop one application which receives events from event hub but I am confused about how should I proceed wihtout this information.Please help with this problem.我想开发一个从事件中心接收事件的应用程序,但我不知道如何在没有这些信息的情况下进行。请帮助解决这个问题。

I am following this link for reference Azure Event Hub.我正在关注此链接以供参考Azure 事件中心。

I am confused about how should I proceed wihtout this information我很困惑我应该如何在没有这些信息的情况下进行

It seems that in order to use Event Hub, you are required to have something to manage checkpoints.似乎为了使用事件中心,您需要有一些东西来管理检查点。 Most of the examples and documentation show using Azure Storage to hold the checkpoints that are automatically made by the current .Net Azure SDK code base.大多数示例和文档显示使用 Azure 存储来保存由当前 .Net Azure SDK 代码库自动创建的检查点。 The current documentation on the EventProcessorHost doesn't appear to show the one of the constructors that does not require a storage account but a custom class that you write that derives from ICheckpointManager . EventProcessorHost上的当前文档似乎没有显示不需要存储帐户的构造函数之一,而是显示您编写的从ICheckpointManager派生的自定义类。

The constructor that isn't documented (at this point in time) looks like:未记录的构造函数(此时)如下所示:

    //
    // Summary:
    //     Create a new host to process events from an Event Hub.
    //     This overload of the constructor allows maximum flexibility. This one allows
    //     the caller to specify the name of the processor host as well. The overload also
    //     allows the caller to provide their own lease and checkpoint managers to replace
    //     the built-in ones based on Azure Storage.
    //
    // Parameters:
    //   hostName:
    //     Name of the processor host. MUST BE UNIQUE. Strongly recommend including a Guid
    //     to ensure uniqueness.
    //
    //   eventHubPath:
    //     The name of the EventHub.
    //
    //   consumerGroupName:
    //     The name of the consumer group within the Event Hub.
    //
    //   eventHubConnectionString:
    //     Connection string for the Event Hub to receive from.
    //
    //   checkpointManager:
    //     Object implementing ICheckpointManager which handles partition checkpointing.
    //
    //   leaseManager:
    //     Object implementing ILeaseManager which handles leases for partitions.
    public EventProcessorHost(string hostName, string eventHubPath, string consumerGroupName, string eventHubConnectionString, ICheckpointManager checkpointManager, ILeaseManager leaseManager);

You will have to use Custom CheckpointManager for EventProcessorHost (EPH) if you dont want to use default azure checkpoint manager.如果您不想使用默认的 azure 检查点管理器,则必须为 EventProcessorHost (EPH)使用自定义检查点管理器。 Mikhailshilkov has a sample SQL checkpointmanager implementaion. Mikhailshilkov 有一个示例 SQL 检查点管理器实现。 SQLcheckpointManager Sample SQLcheckpointManager 示例

You can use EventHubConsumerClient.ReadEventsAsync .您可以使用EventHubConsumerClient.ReadEventsAsync To me this is better, because I don't want to use blob storage.对我来说这更好,因为我不想使用 blob 存储。 But I am getting Error reading event: EventHubsException(ConsumerDisconnected) from time to time但我Error reading event: EventHubsException(ConsumerDisconnected)收到Error reading event: EventHubsException(ConsumerDisconnected)

Refer docs: https://docs.microsoft.com/en-us/java/api/com.azure.messaging.eventhubs?view=azure-java-stable参考文档: https : //docs.microsoft.com/en-us/java/api/com.azure.messaging.eventhubs? view = azure-java- stable

Code snippet :代码片段:

EventHubConsumerAsyncClient consumer = new EventHubClientBuilder()
         .connectionString(connectionStr,eventhubName)
         .consumerGroup(EventHubClientBuilder.DEFAULT_CONSUMER_GROUP_NAME)
         .buildAsyncConsumerClient();
// Receive data for partition "0"
 consumer.receiveFromPartition("0", EventPosition.latest()).subscribe(event -> {
        System.out.println("Event received : "+event.getData().getBodyAsString());

      });

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

相关问题 我们可以将天蓝色事件中心与天蓝色通知中心连接吗? - Can we connect azure event hub with azure notification hub? 我们能否在不影响其他客户数据的情况下为不同客户使用单个 Azure 事件中心? - Can we use single Azure Event Hub for different customer without compromising other customer data? Azure Blob 存储:按容器名称筛选 BlobCreated 事件的事件订阅 - Azure Blob Storage: Filter Event Subscription for the BlobCreated Event by Container Name Azure存储Blob到Azure Event Hub - Azure storage blob to Azure Event Hub Azure-将事件中心消费到DocumentDB(而非存储帐户) - Azure - Consume Event Hub to DocumentDB (not Storage Account) 如何更新事件中心 Microsoft Azure 中的数据 - How can I update Data in Event Hub Microsoft Azure 无法通过事件中心在Azure流分析上收到输入 - Cant receive an input on Azure Stream Analytics via Event Hub Azure事件中心超时 - Azure Event Hub timeouts 如何从 C# 控制台应用程序中的事件网格(Azure 门户)的 QueueStorage 接收消息? - How can I receive the message from a QueueStorage of Event Grid (Azure Portal) in a C# Console app? 来自 Azure 密钥保管库的 NLog Azure 事件集线器连接字符串 - NLog Azure event hub connection string from Azure key vault
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM