Search code examples
c#azure-functionsazure-eventhub

EventHubTrigger in functions v1 - set initialOffsetOptions


When working with Azure Functions v2 (and higher) and Event Hub it's possible to configure the location in the event stream from which to start processing using the initialOffsetOptions/type setting in host.json file:

{
    "version": "2.0",
    "extensions": {
        "eventHubs":
            "initialOffsetOptions": {
                "type": "fromStart",
            }
        }
    }
}

Unfortunately I'm stuck with v1 because of some external dependencies so I'm really curious to see if it's possible to configure a similar setting in previous versions and if it's not (which seems to be the most likely scenario as this is a feature which was released on Dec 2020), what the default behaviour is in v1.

Thanks!


Solution

  • In V1, we don't have the option initialOffsetOptions in host.json. The default behavior in V1 is that it starts from the very beginning of the event stream(Like specify fromStart for initialOffsetOptions in V2 or higher.).

    This new feature of initialOffsetOptions is requested by this github issue: Allow users to specify offset / timestamp to configure starting point for Event Hub. In this issue, it stated the previous behavior.