简体   繁体   English

Azure function 未由 EventHubTrigger 触发

[英]Azure function not triggered by EventHubTrigger

I have an event hub that has a load of events in it.我有一个事件中心,其中包含大量事件。 I also have an Azure function written in C#, but it's not receiving any events.我还有一个用 C# 编写的 Azure function,但它没有收到任何事件。 This is what the setup looks like:这是设置的样子:

Function: Function:

private const string EventHubName = "eventhub";
private const string ConnectionStringName = "Settings:EventHubConsumerConnectionstring";

[FunctionName("InformationHandler")]
public async Task RunAsync(
    [EventHubTrigger(EventHubName, Connection = ConnectionStringName)] EventData[] eventData,
    ILogger log)

Host.json:主机.json:

{
    "version": "2.0",
    "aggregator": {
        "batchSize": 1000,
        "flushTimeout": "00:01:00"
    },
    "logging": {
        "applicationInsights": {
            "samplingExcludedTypes": "Request",
            "samplingSettings": {
                "isEnabled": true
            }
        }
    },
    "extensions": {
        "eventHubs": {
            "batchCheckpointFrequency": 1,
            "eventProcessorOptions": {
                "maxBatchSize": 64,
                "prefetchCount": 128
            }
        }
    }
}

Output when running: Output 运行时:

Functions:

        InformationHandler: eventHubTrigger

For detailed output, run func with --verbose flag.
[2021-02-25T21:48:01.621Z] Host lock lease acquired by instance ID '000000000000000000000000DC59BDB5'.

I'm using netcoreapp3.1 with Azure Functions 3. I have the following NuGet packages installed:我正在使用带有 Azure 功能 3 的 netcoreapp3.1。我安装了以下 NuGet 软件包:

在此处输入图像描述

Does anyone know why I'm not receiving any events?有谁知道为什么我没有收到任何事件? The connection string is correct and it can find the settings in my settings file.连接字符串是正确的,它可以在我的设置文件中找到设置。

Your code seems correct.您的代码似乎正确。 Here are some points you can check:您可以检查以下几点:

1.Please make you're using the event hub namespace level connection string. 1.请让您使用event hub namespace level的连接字符串。

2.you can also create a new consumer group and use the new consumer group in your azure function. 2.您也可以创建一个新的consumer group ,并在您的azure function中使用新的consumer group

3.It may be a temp issue. 3.这可能是一个临时问题。 Just restart your function or create a new function to see if it can work.只需重新启动您的 function 或创建一个新的 function 看看它是否可以工作。

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

相关问题 运行多个实例的Azure Function EventHubTrigger - Azure Function EventHubTrigger running multiple instances 在Azure EventHubTrigger Function应用中设置列 - Set columns in Azure EventHubTrigger Function app EventHubTrigger 在 Azure Functions 中不起作用 - EventHubTrigger is not working in Azure Functions Azure Function EventHubTrigger 如何从 Azure App Configuration 中读取 EventHubName 和 Connection 字符串? - Azure Function EventHubTrigger how to read EventHubName and Connection string from Azure App Configuration? 使用 azure appsettings 读取 azure webjob 中 EventHubTrigger 的连接字符串 - Use azure appsettings to read connection string for EventHubTrigger in azure webjob 如何更新webhook触发的azure函数中的记录? - How to update the record in an azure function triggered by a webhook? 在Azure WebJob中动态启用/禁用触发的功能 - Dynamically enable/ disable a triggered function in Azure WebJob 由 Blob 存储上的 EventGrid 触发的 Azure 函数 - Azure Function triggered by EventGrid on Blob Storage 对时间触发的 Azure 函数进行单元测试 - Unit Test a Time Triggered Azure Function 如何配置 singleton - 队列触发 Azure Function - How to configure for singleton - Queue Triggered Azure Function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM