Skip to content

Event Hub Subscribers

Paul Mcilreavy edited this page Dec 22, 2025 · 2 revisions

Event Hub subscribers deliver events to Azure Event Hubs.

Settings

Setting Description
name The name of the subscriber.
connectionString The Event Hub connection string. Can be omitted if eventHubConnectionString is set at the topic level.
namespace The Event Hub namespace (without .servicebus.windows.net suffix). Alternative to connectionString. Can inherit from topic-level settings.
sharedAccessKeyName The shared access key name (e.g., RootManageSharedAccessKey). Used with namespace.
sharedAccessKey The shared access key. Used with namespace.
eventHubName The name of the Event Hub to send events to. (Required)
disabled (Optional) Set to true to disable this subscriber. Events will not be delivered to disabled subscribers.
deliverySchema (Optional) Override the delivery schema. Values: EventGridSchema or CloudEventV1_0.
filter (Optional) Event filtering configuration. See Filtering.
properties (Optional) Custom delivery properties to add to Event Hub messages. See below.
retryPolicy (Optional) Retry policy settings. See Retry and Dead-Letter.
deadLetter (Optional) Dead-letter settings. See Retry and Dead-Letter.

Basic Example

{
  "subscribers": {
    "eventHub": [
      {
        "name": "OrdersEventHub",
        "connectionString": "Endpoint=sb://my-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=...",
        "eventHubName": "orders-events"
      }
    ]
  }
}

Using Topic-Level Connection String

You can set the connection string at the topic level and have subscribers inherit it:

{
  "topics": [
    {
      "name": "OrdersTopic",
      "port": 60101,
      "eventHubConnectionString": "Endpoint=sb://my-namespace.servicebus.windows.net/;...",
      "subscribers": {
        "eventHub": [
          {
            "name": "OrdersEventHub",
            "eventHubName": "orders-events"
          }
        ]
      }
    }
  ]
}

Using Namespace Authentication

Instead of a connection string, you can use namespace with shared access key:

{
  "topics": [
    {
      "name": "OrdersTopic",
      "port": 60101,
      "eventHubNamespace": "my-eventhub-namespace",
      "eventHubSharedAccessKeyName": "RootManageSharedAccessKey",
      "eventHubSharedAccessKey": "...",
      "subscribers": {
        "eventHub": [
          {
            "name": "OrdersEventHub",
            "eventHubName": "orders-events"
          }
        ]
      }
    }
  ]
}

Message Headers

Event Hub messages include standard Event Grid headers as properties:

Header Description
aeg-event-type Always "Notification"
aeg-subscription-name The subscriber name (uppercase)
aeg-delivery-count The delivery attempt number
aeg-output-event-id The event ID
aeg-data-version The event data version (EventGrid schema only)
aeg-metadata-version Always "1" (EventGrid schema only)

Delivery Properties

You can add custom application properties to Event Hub messages using static or dynamic values:

{
  "properties": {
    "Region": {
      "type": "static",
      "value": "west-us"
    },
    "OrderId": {
      "type": "dynamic",
      "value": "data.orderId"
    }
  }
}

Property Types

  • Static properties: The value is used as-is.
  • Dynamic properties: The value is a path to extract from the event.

Supported Dynamic Paths

  • Top-level fields: Id, Subject, EventType, EventTime, DataVersion, Source, Topic
  • Data properties: data.propertyName or data.nested.property

Complete Example

{
  "topics": [
    {
      "name": "OrdersTopic",
      "port": 60101,
      "key": "TheLocal+DevelopmentKey=",
      "eventHubConnectionString": "Endpoint=sb://my-eventhub-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=...",
      "subscribers": {
        "eventHub": [
          {
            "name": "OrdersEventHubSubscription",
            "eventHubName": "orders-events",
            "deliverySchema": "CloudEventV1_0",
            "filter": {
              "includedEventTypes": ["Order.Created"]
            },
            "properties": {
              "OrderId": { "type": "dynamic", "value": "data.orderId" },
              "Region": { "type": "static", "value": "west-us" }
            }
          }
        ]
      }
    }
  ]
}

Related Topics

Clone this wiki locally