Skip to content

Service Bus Subscribers

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

Service Bus subscribers deliver events to Azure Service Bus queues or topics.

Settings

Setting Description
name The name of the subscriber.
connectionString The Service Bus connection string. Can be omitted if serviceBusConnectionString is set at the topic level.
namespace The Service Bus 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.
queue The queue name. Either queue or topic must be specified (not both).
topic The topic name. Either queue or topic must be specified (not both).
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 Service Bus 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": {
    "serviceBus": [
      {
        "name": "OrdersQueue",
        "connectionString": "Endpoint=sb://my-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=...",
        "queue": "orders-queue"
      }
    ]
  }
}

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,
      "serviceBusConnectionString": "Endpoint=sb://my-namespace.servicebus.windows.net/;...",
      "subscribers": {
        "serviceBus": [
          {
            "name": "OrdersQueue",
            "queue": "orders-queue"
          }
        ]
      }
    }
  ]
}

Using Namespace Authentication

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

{
  "topics": [
    {
      "name": "OrdersTopic",
      "port": 60101,
      "serviceBusNamespace": "my-namespace",
      "serviceBusSharedAccessKeyName": "RootManageSharedAccessKey",
      "serviceBusSharedAccessKey": "...",
      "subscribers": {
        "serviceBus": [
          {
            "name": "OrdersQueue",
            "queue": "orders-queue"
          }
        ]
      }
    }
  ]
}

Delivery Properties

You can add custom application properties to Service Bus messages using static or dynamic values:

{
  "properties": {
    "Region": {
      "type": "static",
      "value": "west-us"
    },
    "EventType": {
      "type": "dynamic",
      "value": "EventType"
    },
    "CustomerId": {
      "type": "dynamic",
      "value": "data.customerId"
    }
  }
}

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

Filtering Events

You can filter which events are delivered to a subscriber. See Filtering for the complete filtering reference.

{
  "subscribers": {
    "serviceBus": [
      {
        "name": "HighPriorityOrders",
        "queue": "high-priority-orders",
        "filter": {
          "includedEventTypes": ["Order.Created"],
          "advancedFilters": [
            {
              "operatorType": "NumberGreaterThan",
              "key": "data.amount",
              "value": 1000
            }
          ]
        }
      }
    ]
  }
}

Complete Example

{
  "topics": [
    {
      "name": "OrdersTopic",
      "port": 60101,
      "key": "TheLocal+DevelopmentKey=",
      "serviceBusConnectionString": "Endpoint=sb://my-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=...",
      "subscribers": {
        "serviceBus": [
          {
            "name": "OrdersQueueSubscription",
            "queue": "orders-queue",
            "properties": {
              "OrderId": { "type": "dynamic", "value": "data.orderId" },
              "EventType": { "type": "dynamic", "value": "EventType" },
              "Source": { "type": "static", "value": "EventGridSimulator" }
            }
          }
        ]
      }
    }
  ]
}

Related Topics

Clone this wiki locally