quinzee.cloud

Development edition · 16 November 2026. Commands using repository paths, Make targets or sample projects require access to the Quinzee source checkout. No public installer is available. Examples use disposable local environments.

Developer’s guide

26. Provision event delivery and durable messaging

Run the infrastructure workshop first. Each file below is complete and deploys at resource-group scope. Use a separate deployment name for each lesson so its operation history is easy to find.

Route changes into a queue

This complete lesson creates a storage account, a queue and a table, then connects both a storage system topic and a custom topic to that queue. A system topic observes Blob changes. A custom topic accepts application-published events. Both use explicit destination resource IDs.

Step 1: save the Bicep

The repository copy is examples/book-iac/event-grid.bicep. To experiment, save this complete sample to .local/book-iac/event-grid.bicep:

// Table Storage and Event Grid in one deployment: a storage account with a
// table and a queue, a system topic that sends Blob Created events to the
// queue, and a custom topic whose events go to the same queue.
targetScope = 'resourceGroup'

@minLength(3)
@maxLength(12)
param prefix string
param location string = resourceGroup().location

resource storage 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: '${prefix}events'
  location: location
  kind: 'StorageV2'
  sku: { name: 'Standard_LRS' }
}
resource tables 'Microsoft.Storage/storageAccounts/tableServices@2023-05-01' = {
  parent: storage
  name: 'default'
}
resource orders 'Microsoft.Storage/storageAccounts/tableServices/tables@2023-05-01' = {
  parent: tables
  name: 'Orders'
}
resource queues 'Microsoft.Storage/storageAccounts/queueServices@2023-05-01' = {
  parent: storage
  name: 'default'
}
resource inbox 'Microsoft.Storage/storageAccounts/queueServices/queues@2023-05-01' = {
  parent: queues
  name: 'inbox'
}
resource blobEvents 'Microsoft.EventGrid/systemTopics@2025-02-15' = {
  name: '${prefix}-blobs'
  location: location
  properties: {
    source: storage.id
    topicType: 'Microsoft.Storage.StorageAccounts'
  }
}
resource blobToQueue 'Microsoft.EventGrid/systemTopics/eventSubscriptions@2025-02-15' = {
  parent: blobEvents
  name: 'blob-created'
  properties: {
    destination: {
      endpointType: 'StorageQueue'
      properties: {
        resourceId: storage.id
        queueName: inbox.name
      }
    }
    filter: { includedEventTypes: ['Microsoft.Storage.BlobCreated'] }
  }
}
resource orderTopic 'Microsoft.EventGrid/topics@2025-02-15' = {
  name: '${prefix}-orders'
  location: location
}
resource orderToQueue 'Microsoft.EventGrid/topics/eventSubscriptions@2025-02-15' = {
  parent: orderTopic
  name: 'orders-to-queue'
  properties: {
    destination: {
      endpointType: 'StorageQueue'
      properties: {
        resourceId: storage.id
        queueName: inbox.name
      }
    }
  }
}
output tableEndpoint string = storage.properties.primaryEndpoints.table
output queueEndpoint string = storage.properties.primaryEndpoints.queue
output blobEndpoint string = storage.properties.primaryEndpoints.blob
output topicEndpoint string = orderTopic.properties.endpoint

Step 2: inspect the ARM equivalent

The compiler emits these resource objects. The surrounding template also contains the parameters and outputs declared above. Expressions in square brackets are evaluated by the deployment engine, not by your shell.

[
  {
    "type": "Microsoft.Storage/storageAccounts",
    "apiVersion": "2023-05-01",
    "name": "[format('{0}events', parameters('prefix'))]",
    "location": "[parameters('location')]",
    "kind": "StorageV2",
    "sku": {
      "name": "Standard_LRS"
    }
  },
  {
    "type": "Microsoft.Storage/storageAccounts/tableServices",
    "apiVersion": "2023-05-01",
    "name": "[format('{0}/{1}', format('{0}events', parameters('prefix')), 'default')]",
    "dependsOn": [
      "[resourceId('Microsoft.Storage/storageAccounts', format('{0}events', parameters('prefix')))]"
    ]
  },
  {
    "type": "Microsoft.Storage/storageAccounts/tableServices/tables",
    "apiVersion": "2023-05-01",
    "name": "[format('{0}/{1}/{2}', format('{0}events', parameters('prefix')), 'default', 'Orders')]",
    "dependsOn": [
      "[resourceId('Microsoft.Storage/storageAccounts/tableServices', format('{0}events', parameters('prefix')), 'default')]"
    ]
  },
  {
    "type": "Microsoft.Storage/storageAccounts/queueServices",
    "apiVersion": "2023-05-01",
    "name": "[format('{0}/{1}', format('{0}events', parameters('prefix')), 'default')]",
    "dependsOn": [
      "[resourceId('Microsoft.Storage/storageAccounts', format('{0}events', parameters('prefix')))]"
    ]
  },
  {
    "type": "Microsoft.Storage/storageAccounts/queueServices/queues",
    "apiVersion": "2023-05-01",
    "name": "[format('{0}/{1}/{2}', format('{0}events', parameters('prefix')), 'default', 'inbox')]",
    "dependsOn": [
      "[resourceId('Microsoft.Storage/storageAccounts/queueServices', format('{0}events', parameters('prefix')), 'default')]"
    ]
  },
  {
    "type": "Microsoft.EventGrid/systemTopics",
    "apiVersion": "2025-02-15",
    "name": "[format('{0}-blobs', parameters('prefix'))]",
    "location": "[parameters('location')]",
    "properties": {
      "source": "[resourceId('Microsoft.Storage/storageAccounts', format('{0}events', parameters('prefix')))]",
      "topicType": "Microsoft.Storage.StorageAccounts"
    },
    "dependsOn": [
      "[resourceId('Microsoft.Storage/storageAccounts', format('{0}events', parameters('prefix')))]"
    ]
  },
  {
    "type": "Microsoft.EventGrid/systemTopics/eventSubscriptions",
    "apiVersion": "2025-02-15",
    "name": "[format('{0}/{1}', format('{0}-blobs', parameters('prefix')), 'blob-created')]",
    "properties": {
      "destination": {
        "endpointType": "StorageQueue",
        "properties": {
          "resourceId": "[resourceId('Microsoft.Storage/storageAccounts', format('{0}events', parameters('prefix')))]",
          "queueName": "inbox"
        }
      },
      "filter": {
        "includedEventTypes": [
          "Microsoft.Storage.BlobCreated"
        ]
      }
    },
    "dependsOn": [
      "[resourceId('Microsoft.EventGrid/systemTopics', format('{0}-blobs', parameters('prefix')))]",
      "[resourceId('Microsoft.Storage/storageAccounts/queueServices/queues', format('{0}events', parameters('prefix')), 'default', 'inbox')]",
      "[resourceId('Microsoft.Storage/storageAccounts', format('{0}events', parameters('prefix')))]"
    ]
  },
  {
    "type": "Microsoft.EventGrid/topics",
    "apiVersion": "2025-02-15",
    "name": "[format('{0}-orders', parameters('prefix'))]",
    "location": "[parameters('location')]"
  },
  {
    "type": "Microsoft.EventGrid/topics/eventSubscriptions",
    "apiVersion": "2025-02-15",
    "name": "[format('{0}/{1}', format('{0}-orders', parameters('prefix')), 'orders-to-queue')]",
    "properties": {
      "destination": {
        "endpointType": "StorageQueue",
        "properties": {
          "resourceId": "[resourceId('Microsoft.Storage/storageAccounts', format('{0}events', parameters('prefix')))]",
          "queueName": "inbox"
        }
      }
    },
    "dependsOn": [
      "[resourceId('Microsoft.Storage/storageAccounts/queueServices/queues', format('{0}events', parameters('prefix')), 'default', 'inbox')]",
      "[resourceId('Microsoft.EventGrid/topics', format('{0}-orders', parameters('prefix')))]",
      "[resourceId('Microsoft.Storage/storageAccounts', format('{0}events', parameters('prefix')))]"
    ]
  }
]

Step 3: compile, deploy and check

python3 scripts/deps/bicep.py build .local/book-iac/event-grid.bicep \
  --outfile .local/book-iac/event-grid.json

Supply these required parameters: prefix. Run the deployment command from the workshop with --name event-grid, --template .local/book-iac/event-grid.json and a distinct outputs filename. Add --parameters when supplying inputs. Select the same deployment in QHQ and wait for Succeeded.

After deployment, upload a Blob and inspect the inbox queue. Publish an event to the custom topic and expect another notification. Event delivery retries may duplicate notifications, so make the consumer idempotent. The destination queue is a service resource; its name and account ID must match the subscription.

Give independent consumers their own subscriptions

Supply a unique namespaceName, for example booklab-bus. Queues distribute competing work. A topic copies each message to every existing subscription, so the first and second consumers each receive their own copy. The AMQP listener must be enabled before using the Service Bus SDK.

Step 1: save the Bicep

The repository copy is examples/book-iac/service-bus.bicep. To experiment, save this complete sample to .local/book-iac/service-bus.bicep:

// Durable messaging: a queue and a topic with two independent subscriptions.
// Quinzee Cloud - proprietary and confidential. All rights reserved.
targetScope = 'resourceGroup'

@minLength(6)
@maxLength(50)
param namespaceName string
param location string = resourceGroup().location

resource bus 'Microsoft.ServiceBus/namespaces@2024-01-01' = {
  name: namespaceName
  location: location
  sku: { name: 'Standard', tier: 'Standard' }
}
resource orders 'Microsoft.ServiceBus/namespaces/queues@2024-01-01' = {
  parent: bus
  name: 'orders'
  properties: {
    lockDuration: 'PT1M'
    maxDeliveryCount: 10
  }
}
resource events 'Microsoft.ServiceBus/namespaces/topics@2024-01-01' = {
  parent: bus
  name: 'events'
}
resource first 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2024-01-01' = {
  parent: events
  name: 'first'
}
resource second 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2024-01-01' = {
  parent: events
  name: 'second'
}
output namespaceId string = bus.id
output queueId string = orders.id

Step 2: inspect the ARM equivalent

The compiler emits these resource objects. The surrounding template also contains the parameters and outputs declared above. Expressions in square brackets are evaluated by the deployment engine, not by your shell.

[
  {
    "type": "Microsoft.ServiceBus/namespaces",
    "apiVersion": "2024-01-01",
    "name": "[parameters('namespaceName')]",
    "location": "[parameters('location')]",
    "sku": {
      "name": "Standard",
      "tier": "Standard"
    }
  },
  {
    "type": "Microsoft.ServiceBus/namespaces/queues",
    "apiVersion": "2024-01-01",
    "name": "[format('{0}/{1}', parameters('namespaceName'), 'orders')]",
    "properties": {
      "lockDuration": "PT1M",
      "maxDeliveryCount": 10
    },
    "dependsOn": [
      "[resourceId('Microsoft.ServiceBus/namespaces', parameters('namespaceName'))]"
    ]
  },
  {
    "type": "Microsoft.ServiceBus/namespaces/topics",
    "apiVersion": "2024-01-01",
    "name": "[format('{0}/{1}', parameters('namespaceName'), 'events')]",
    "dependsOn": [
      "[resourceId('Microsoft.ServiceBus/namespaces', parameters('namespaceName'))]"
    ]
  },
  {
    "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions",
    "apiVersion": "2024-01-01",
    "name": "[format('{0}/{1}/{2}', parameters('namespaceName'), 'events', 'first')]",
    "dependsOn": [
      "[resourceId('Microsoft.ServiceBus/namespaces/topics', parameters('namespaceName'), 'events')]"
    ]
  },
  {
    "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions",
    "apiVersion": "2024-01-01",
    "name": "[format('{0}/{1}/{2}', parameters('namespaceName'), 'events', 'second')]",
    "dependsOn": [
      "[resourceId('Microsoft.ServiceBus/namespaces/topics', parameters('namespaceName'), 'events')]"
    ]
  }
]

Step 3: compile, deploy and check

python3 scripts/deps/bicep.py build .local/book-iac/service-bus.bicep \
  --outfile .local/book-iac/service-bus.json

Supply these required parameters: namespaceName. Run the deployment command from the workshop with --name service-bus, --template .local/book-iac/service-bus.json and a distinct outputs filename. Add --parameters when supplying inputs. Select the same deployment in QHQ and wait for Succeeded.

QHQ lists the namespace, orders queue, events topic and two subscriptions. Run the Service Bus chapter to send and settle messages. Change maxDeliveryCount and redeploy without deleting the queue; existing messages remain. Use supported Standard tier and AMQP/TLS, not WebSockets.