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. This is what the setup looks like:
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:
{
"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:
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:
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.
2.you can also create a new consumer group
and use the new consumer group
in your azure function.
3.It may be a temp issue. Just restart your function or create a new function to see if it can work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.