Dotnet Core console app which connects to Azure IotHub (EventHub should work the same?) and reads Checkpoint/Offset info from the last message in the Hub and writes that (Offset and SequenceNumber) to the targeted azure-webjobs-eventhub blob container.
When consuming messages in an Azure IoT- or EventHub from an Azure EventHubTriggered Function you got no means to indicate from where you want to start consuming your messages. If your Trigger Function "falls behind" and messages are added to hub with a high frequence you might never catch up and spend compute time (and money) on cathing up (on stuff you might not be interested in if you only want the latest).
- This program could probably cause a lot of mess if/when not working properly, use at own risk!
- This program is hopefully not needed when fixed in Azure Webjobs SDK and support is added (function attributes bindings?)
- The function host using targetConsumerGroup and its underlying storage should not be running while this program executes.
- Clone this repo
- Populate appsetting.json with your config
- Actually read what the code does (again, use at your own risk)
- Build and run!
Sample for use with local storage emulator (Note, storage emulator seems to be discontinued and support only Storage SDK < 11 (i.e currently 10.0.3))
{
"ConnectionStrings": {
"BlobStorage": "UseDevelopmentStorage=true"
},
"Vars": {
"EventHubHostname": "...",
"EventHubName": "...",
"EventHubSasKey": "...",
"TargetConsumerGroup": "..."
}
}