# Azure Event Hubs

Type: `bindings.azure.eventhubs`

Status: stable

Reference: https://docs.dapr.io/reference/components-reference/supported-bindings/eventhubs/

## Example

```
apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
  name: <name>
spec:
  type: bindings.azure.eventhubs
  version: v1
  metadata:
    # Connection string for the Event Hub or the Event Hub namespace.
    - name: connectionString
      value: "Endpoint=sb://{EventHubNamespace}.servicebus.windows.net/;SharedAccessKeyName={PolicyName};SharedAccessKey={Key};EntityPath={EventHub}"
    # The name of the Event Hubs hub ("topic"). Required if the connection string doesn't contain an EntityPath value. (Optional)
    #- name: eventHub
    #  value: "mytopic"
    # Indicates the direction of the binding component.
    - name: direction
      value: "input,output"
    # The name of the Event Hubs Consumer Group to listen on. (Optional)
    #- name: consumerID
    #  value: "group1"
    # When set to true, will retrieve all message properties and include them in the returned event metadata (Optional)
    #- name: getAllMessageProperties
    #  value: "false"
    # Specifies a custom route for incoming events. (Optional)
    #- name: route
    #  value: "/custom-path"
    # Storage account key for the checkpoint store account. When using Azure AD, it is possible to omit this if the service principal has access to the storage account too. Property "storageAccountKey" is ignored when "storageConnectionString" is present (Optional)
    #- name: storageAccountKey
    #  value: "112233445566778899"
    # Storage account name to use for the checkpoint store. (Optional)
    #- name: storageAccountName
    #  value: "myeventhubstorage"
    # Connection string for the checkpoint store, alternative to specifying storageAccountKey. Property "storageAccountKey" is ignored when "storageConnectionString" is present (Optional)
    #- name: storageConnectionString
    #  value: "BlobEndpoint=https://storagesample.blob.core.windows.net;..."
    # Storage container name. (Optional)
    #- name: storageContainerName
    #  value: "myeventhubstoragecontainer"

```

## Binding information

Input Binding: yes

Output Binding: yes

### Output Binding operations:

- `create`: Create an event subscription

## Authentication profiles

Available authentication profiles:

- Connection string

- Azure AD: Client credentials

- Azure AD: Client certificate

### Connection string

Authenticate using a connection string.

#### `connectionString`

**Required** - Connection string for the Event Hub or the Event Hub namespace.

Example value: `Endpoint=sb://{EventHubNamespace}.servicebus.windows.net/;SharedAccessKeyName={PolicyName};SharedAccessKey={Key};EntityPath={EventHub}`

#### `eventHub` (string)

The name of the Event Hubs hub ("topic"). Required if the connection string doesn't contain an EntityPath value.

Example value: `mytopic`

### Azure AD: Client credentials

Authenticate using Azure AD with client credentials, also known as "service principals".

#### `azureClientId`

**Required** - Client ID (application ID)

Example value: `c7dd251f-811f-4ba2-a905-acd4d3f8f08b`

#### `azureClientSecret`

**Required** - Client secret (application password)

Example value: `Ecy3XG7zVZK3/vl/a2NSB+a1zXLa8RnMum/IgD0E`

#### `azureTenantId`

**Required** - ID of the Azure AD tenant

Example value: `cd4b2887-304c-47e1-b4d5-65447fdd542a`

#### `eventHub` (string)

**Required** - The name of the Event Hubs hub (“topic”).

Example value: `mytopic`

#### `eventHubNamespace` (string)

**Required** - The Event Hub Namespace name.

Example value: `namespace`

#### `azureEnvironment`

Optional name for the Azure environment if using a different Azure cloud

Default value: `AzurePublicCloud`

Example value: `AzurePublicCloud`

Allowed values:

- AzurePublicCloud

- AzureChinaCloud

- AzureUSGovernmentCloud

#### `enableEntityManagement` (bool)

Allow management of the Event Hub namespace and storage account.

Default value: `false`

Example value: `false`

#### `enableInOrderMessageDelivery` (bool)

Enable in order processing of messages within a partition.

Default value: `false`

Example value: `false`

#### `messageRetentionInDays` (number)

Number of days to retain messages for in the newly created Event Hub namespace. Used only when entity management is enabled.

Default value: `1`

Example value: `90`

#### `partitionCount` (number)

Number of partitions for the new Event Hub namespace. Used only when entity management is enabled.

Default value: `1`

Example value: `3`

#### `resourceGroupName` (string)

Name of the resource group the Event Hub namespace is part of. Required when entity management is enabled.

Example value: `test-rg`

#### `subscriptionId` (string)

Azure subscription ID value. Required when entity management is enabled Used for input binding direction.

Example value: `00112233-4455-6677-8899-aabbccddeeff`

### Azure AD: Client certificate

Authenticate using Azure AD with a client certificate. "azureCertificate" is required.

#### `azureClientId`

**Required** - Client ID (application ID)

Example value: `c7dd251f-811f-4ba2-a905-acd4d3f8f08b`

#### `azureTenantId`

**Required** - ID of the Azure AD tenant

Example value: `cd4b2887-304c-47e1-b4d5-65447fdd542a`

#### `eventHub` (string)

**Required** - The name of the Event Hubs hub (“topic”).

Example value: `mytopic`

#### `eventHubNamespace` (string)

**Required** - The Event Hub Namespace name.

Example value: `namespace`

#### `azureCertificate`

Certificate and private key (in either a PEM file containing both the certificate and key, or in PFX/PKCS#12 format)

Example value:

```
-----BEGIN PRIVATE KEY-----\n MIIEvgI... \n -----END PRIVATE KEY-----
\n -----BEGIN CERTIFICATE----- \n MIICoTC... \n -----END CERTIFICATE----- \n

```

#### `azureCertificatePassword`

Password for the certificate if encrypted.

Example value: `password`

#### `azureEnvironment`

Optional name for the Azure environment if using a different Azure cloud

Default value: `AzurePublicCloud`

Example value: `AzurePublicCloud`

Allowed values:

- AzurePublicCloud

- AzureChinaCloud

- AzureUSGovernmentCloud

#### `enableEntityManagement` (bool)

Allow management of the Event Hub namespace and storage account.

Default value: `false`

Example value: `false`

#### `enableInOrderMessageDelivery` (bool)

Enable in order processing of messages within a partition.

Default value: `false`

Example value: `false`

#### `messageRetentionInDays` (number)

Number of days to retain messages for in the newly created Event Hub namespace. Used only when entity management is enabled.

Default value: `1`

Example value: `90`

#### `partitionCount` (number)

Number of partitions for the new Event Hub namespace. Used only when entity management is enabled.

Default value: `1`

Example value: `3`

#### `resourceGroupName` (string)

Name of the resource group the Event Hub namespace is part of. Required when entity management is enabled.

Example value: `test-rg`

#### `subscriptionId` (string)

Azure subscription ID value. Required when entity management is enabled Used for input binding direction.

Example value: `00112233-4455-6677-8899-aabbccddeeff`

## Metadata

### `direction` (string)

**Required** - Indicates the direction of the binding component.

Example value: `input,output`

Allowed values:

- input

- output

- input,output

Documentation: https://docs.dapr.io/reference/api/bindings\_api/#binding-direction-optional

### `consumerID` (string)

The name of the Event Hubs Consumer Group to listen on. Used for input binding direction.

Example value: `group1`

### `getAllMessageProperties` (bool)

When set to true, will retrieve all message properties and include them in the returned event metadata Used for input binding direction.

Default value: `false`

Example value: `false`

### `route` (string)

Specifies a custom route for incoming events.

Example value: `/custom-path`

Documentation: https://docs.dapr.io/developing-applications/building-blocks/bindings/howto-triggers/#specify-a-custom-route

### `storageAccountKey` (string)

Storage account key for the checkpoint store account. When using Azure AD, it is possible to omit this if the service principal has access to the storage account too. Property "storageAccountKey" is ignored when "storageConnectionString" is present Used for input binding direction.

Example value: `112233445566778899`

### `storageAccountName` (string)

Storage account name to use for the checkpoint store. Used for input binding direction.

Example value: `myeventhubstorage`

### `storageConnectionString` (string)

Connection string for the checkpoint store, alternative to specifying storageAccountKey. Property "storageAccountKey" is ignored when "storageConnectionString" is present Used for input binding direction.

Example value: `BlobEndpoint=https://storagesample.blob.core.windows.net;...`

### `storageContainerName` (string)

Storage container name. Used for input binding direction.

Example value: `myeventhubstoragecontainer`
