Trigger Specification
This specification describes the azure-eventhub
trigger for Azure Event Hubs.
triggers:
- type: azure-eventhub
metadata:
connectionFromEnv: EVENTHUB_CONNECTIONSTRING_ENV_NAME
storageConnectionFromEnv: STORAGE_CONNECTIONSTRING_ENV_NAME
consumerGroup: $Default
unprocessedEventThreshold: '64'
blobContainer: 'name_of_container'
Parameter list:
connectionFromEnv
- Name of the environment variable your deployment uses to get the connection string appended withEntityPath=<event_hub_name>
.storageConnectionFromEnv
- Name of the environment variable that provides connection string for Azure Storage Account to store checkpoint. As of now the Event Hub scaler only reads from Azure Blob Storage.consumerGroup
- Consumer group of Azure Event Hub consumer. (default:$default
)unprocessedEventThreshold
- Average target value to trigger scaling actions. (Default:64
, Optional)blobContainer
- Container name to store checkpoint. This is needed for everycheckpointStrategy
except ofAzureFunction
. With Azure Functions theblobContainer
is autogenerated and cannot be overridden.checkpointStrategy
- configure the checkpoint behaviour of different Event Hub SDKs. (default:""
)azureFunction
- Suitable for Azure Functions & Azure WebJobs SDK. This is the default setting, whenblobcontainer
is not specified.blobMetadata
- For all implementations that store checkpoint information on blob metadata such as current C#, Python, Java and JavaScript Event Hub SDKs.goSdk
- For all implementations using the Golang SDK’s checkpointing, for example Dapr.- When no checkpoint strategy is specified, the Event Hub scaler will use backwards compatibility and able to scale older implementations of C#, Python or Java Event Hub SDKs. (see “Legacy checkpointing”). If this behaviour should be used,
blobContainer
is also required.
💡 Legacy Checkpointing: C# applications, which use the
Microsoft.Azure.EventHubs
package, Java applications which use theazure-eventhubs-eph
package or Python applications which use theazure-eventhub
belowv5
are supported if nocheckpointStrategy
is specified. These legacy implementations are based on theEventProcessorHost
client, which stores checkpoint information as blob container contentC# Applications that use the current
Azure.Messaging.EventHubs
package, Java applications which use the currentazure-messaging-eventhubs
package or Python applications sinceazure-eventhub v5
, have to set thecheckpointStrategy
toblobMetadata
. All these implementations based on theEventProcessorClient
which stores checkpoint information as blob metadata.
💡 The Azure Storage connection string is not compatible with connection string created from a Shared Access Signature.
Authentication Parameters
The common way of authenticating to Azure Event Hub is by using the connection string. However, you can use Pod Identity if you host your cluster in Azure AKS, and if have configured it to support Pod Identity.
To use Pod Identity, you have to add a TriggerAuthentication and configure it to use Pod Identity like so:
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: nameOfTriggerAuth
namespace: default
spec:
podIdentity:
provider: Azure
When you do so, the Event Hub scaler will depend on the existence of two configurations you have to provide: eventHubNamespace
and eventHubName
.
Example
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: azure-eventhub-scaledobject
namespace: default
spec:
scaleTargetRef:
name: azureeventhub-function
triggers:
- type: azure-eventhub
metadata:
# Required
storageConnectionFromEnv: AzureWebJobsStorage
# Required if not using Pod Identity
connectionFromEnv: EventHub
# Required if using Pod Identity
eventHubNamespace: AzureEventHubNameSpace
eventHubName: NameOfTheEventHub
# Optional
consumerGroup: $Default # default: $Default
unprocessedEventThreshold: '64' # default 64 events.
blobContainer: ehcontainer