[英]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.