Azure Event Hubs trigger and bindings for Azure Functions

Choose a programming language

This article explains how to work with Azure Event Hubs bindings for Azure Functions. Azure Functions supports trigger and output bindings for Event Hubs.

Action Type
Respond to events sent to an event hub event stream. Trigger
Write events to an event stream Output binding

Install extension

The extension NuGet package you install depends on the C# mode you're using in your function app:

Functions execute in the same process as the Functions host. To learn more, see Develop C# class library functions using Azure Functions.

The functionality of the extension varies depending on the extension version:

Version 1.x of the Functions runtime doesn't require an extension.

Install bundle

The Event Hubs extension is part of an extension bundle, which is specified in your host.json project file. You may need to modify this bundle to change the version of the Event Grid binding, or if bundles aren't already installed. To learn more, see extension bundle.

Version 1.x of the Functions runtime doesn't require extension bundles.

host.json settings

The host.json file contains settings that control behavior for the Event Hubs trigger. The configuration is different depending on the extension version.

{
    "eventHub": {
      "maxBatchSize": 64,
      "prefetchCount": 256,
      "batchCheckpointFrequency": 1
    }
}
Property Default Description
maxBatchSize 64 The maximum event count received per receive loop.
prefetchCount 300 The default prefetch that will be used by the underlying EventProcessorHost.
batchCheckpointFrequency 1 The number of event batches to process before creating an EventHub cursor checkpoint.

For a reference of host.json in Azure Functions 1.x, see host.json reference for Azure Functions 1.x.

Next steps