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.
9. Keep events and messages moving
Event Grid delivers notifications. Service Bus retains work until a consumer settles it. Queue Storage is a third, simpler messaging service. Choose the service according to the application contract; their keys, locks, endpoints and failure modes are not interchangeable.
Step 1: provision an Event Grid route
Prepare the supplied Event Grid deployment on the host:
mkdir -p .local/admin-training
python3 scripts/deps/bicep.py build examples/book-iac/event-grid.bicep \
--outfile .local/admin-training/event-grid.json
Use Resource Manager → Deployments to submit that JSON in your training group, as practiced in chapter 7. Defaults need no parameter file. It creates a storage account/queue, a storage system topic and a custom topic, each with a queue destination. Open Event Grid → Topics. Select the custom topic, inspect its subscriptions, and send a synthetic event using the page's test operation. Then inspect the StorageQueue destination. For a system topic, upload a Blob to its source account and observe the BlobCreated notification.
A successful Blob upload is not a delivery receipt for its event. The module uses a durable SQLite outbox and one serial delivery worker. Slow webhooks can delay other deliveries. Pending deliveries survive restart; when limits are exceeded or retries are exhausted, events are counted/logged as dropped. There is no dead-letter destination to recover those dropped events from.
Event Grid settings
| Object | Supported configurable values |
|---|---|
| Custom topic | Name/location/tags, inputSchema EventGridSchema or CloudEventSchemaV1_0, disableLocalAuth |
| System topic | Storage account source, topicType: Microsoft.Storage.StorageAccounts; one topic per source |
| Destination | HTTPS WebHook URL, or StorageQueue resource ID and queue name |
| Filter | includedEventTypes, subjectBeginsWith/subjectEndsWith, isSubjectCaseSensitive |
| Delivery schema | Supported Event Grid or CloudEvents 1.0 output conversion |
| Retry policy | 1–30 attempts, 1–1440 minutes time-to-live |
| Topic credentials | Key1/key2 listing and regeneration, SAS expiry/scope, or supported bearer token |
Webhook creation performs a validation handshake. Event Grid schema endpoints must return the supplied validation code; CloudEvents endpoints answer OPTIONS with WebHook-Allowed-Origin. Delivery uses verified HTTPS, no redirects and a 30-second deadline. A 2xx response acknowledges delivery. A handler that returns success before durably accepting work risks losing that work after a crash. Subscriptions can reach the network visible to the cloud, so manage destination URLs as privileged configuration. Advanced filters, Service Bus destinations, managed-identity delivery, namespaces and MQTT are unsupported.
Fixed bounds include 1 MiB publish bodies, 5,000 events per request and 10,000 pending deliveries. The retry sequence begins at 10 seconds, 30 seconds, one minute, five minutes, ten minutes, thirty minutes, then hourly. These are fixed implementation limits, not undocumented startup knobs.
Step 2: enable Service Bus transport
The standard Compose launch enables TLS AMQP on container port 5671. Native
launches need --service-bus-port 5671; omission leaves HTTPS messaging available
but disables AMQP. Use the same verified native certificate chain or the Azure
SNI certificate for Azure namespace names. Clients use AMQP TCP over TLS, not
plaintext AMQP or WebSockets.
Compile examples/book-iac/service-bus.bicep with the same command pattern,
using service-bus.json as the output. Submit it as a separate deployment. It
creates a Standard namespace, queue, topic and subscriptions. In QHQ's Service
Bus page, choose the namespace, then Queues or Topics; select a topic before
Subscriptions. The page inspects inventory. Create and change those resources
through ARM/Bicep deployments. Namespace keys are not shown in its inventory.
Service Bus settings
| Object | Accepted values |
|---|---|
| Namespace | Standard SKU/tier, name/location/tags, disableLocalAuth, minimumTlsVersion 1.2, publicNetworkAccess Enabled |
| Queue/topic/subscription | status: Active, Disabled, SendDisabled or ReceiveDisabled |
| Queue/subscription | lockDuration PT1M–PT5M; maxDeliveryCount 1–100, default 10 |
| Message | Body and supported properties; default/maximum TTL 14 days, shorter per-message TTL accepted |
| SAS | Primary root rule, namespace/entity scope and expiry; disabled when disableLocalAuth is true |
| Bearer | Service Bus audience plus Data Sender, Receiver or Owner assignment for new identities |
The primary RootManageSharedAccessKey listKeys operation returns a connection
string to an authorized ARM caller. Keep it private. Custom authorization rules,
secondary key rotation, sessions, duplicate detection, schedules, transactions,
batch sends and partitioning are not implemented. An ARM Reader/Contributor
role does not itself grant messaging access.
Step 3: diagnose locks and dead letters
PeekLock reserves a message with a current lock token. Complete removes it;
Abandon makes it available again; renew extends a supported current lock.
ReceiveAndDelete removes on receipt and cannot recover a consumer crash. When
delivery attempts reach maxDeliveryCount, work moves to $DeadLetterQueue.
Inspect and process it explicitly; deleting the namespace is not a repair.
Lock state survives restart, so immediately after restart a message can still
be locked rather than lost.
The broker commits SQLite WAL transactions with synchronous FULL before acknowledging successful mutations. Limits include 1,000 resources, 10,000 retained message copies, 256 MiB store, 256 KiB AMQP messages, 250 KiB REST bodies, 32 connections and 64 concurrent links. One topic message can consume multiple retained copies across subscriptions. Stop producers before capacity work; consumer catch-up and deliberate dead-letter handling are usually safer than removing state files.