Azure Service BUS Topic

Azure Service Bus Topic is a publish-subscribe system that allows multiple subscribers to receive copies of the same message, making it ideal for broadcasting messages to multiple consumers interested in the same data.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Made by

Massdriver

Official

Yes

Azure Service Bus Topic

Azure Service Bus Topics provide a high-performance, reliable, and secure messaging platform for applications. Topics enable scalable and decoupled publish/subscribe communication, allowing multiple subscribers to receive asynchronous messages from a single publisher.

Design Decisions

  1. Namespace Creation: The module creates an Azure Service Bus Namespace that isolates the messaging environment.
  2. Resource Configuration:
    • Service Bus Topic: Configured to enable batched operations, express messaging, partitioning, duplicate detection, and message ordering based on user input.
    • Service Bus Subscription: Configured with maximum delivery count, batched operations, and session-based messaging.
  3. Security:
    • Roles are assigned to manage publishing and subscribing privileges.
    • Enforced TLS 1.2 as the minimum version for secure communication.
  4. Monitoring and Alerts:
    • Automated setup for server error and latency metric alerts.
    • Integration with an alarm channel for actionable notifications.

Runbook

Unable to Connect to Azure Service Bus Namespace

To troubleshoot connectivity issues to the Azure Service Bus Namespace, use the Azure CLI:

# Verify the existence of the Service Bus Namespace
az servicebus namespace show --name <NAMESPACE-NAME> --resource-group <RESOURCE-GROUP-NAME>

You should expect to see details of the namespace if it exists. If not, it might be a configuration or provisioning issue.

Messages are Not Being Received by Subscribers

To troubleshoot subscription issues, check the subscription's status and message count:

# Check the subscription status and message count
az servicebus topic subscription show --resource-group <RESOURCE-GROUP-NAME> --namespace-name <NAMESPACE-NAME> --topic-name <TOPIC-NAME> --name <SUBSCRIPTION-NAME>

High Server Latency Observed

If you observe high server latency, you can verify the metric by checking the configured alert:

# Check metric alerts
az monitor metrics list --resource <SERVICE-BUS-NAMESPACE-ID> --metric ServerSendLatency --interval PT1M --aggregation Average

You should expect the latency statistics that can pinpoint the cause of high server latency.

Subscription Messages are Getting Dead-Lettered

To identify issues where messages are being dead-lettered, inspect the dead-letter sub-queue:

# Peek dead-letter messages
az servicebus topic subscription deadletter message peek --resource-group <RESOURCE-GROUP-NAME> --namespace-name <NAMESPACE-NAME> --topic-name <TOPIC-NAME> --subscription-name <SUBSCRIPTION-NAME>

You should see the messages that have been dead-lettered, which can provide insights into why they were not processed successfully.

VariableTypeDescription
monitoring.modestringEnable and customize Function App metric alarms.
service.regionstringSelect the Azure region you'd like to provision your Azure Service Bus in. Cannot be changed after the resource is created.
service.skustringSelect your desired SKU tier for the Service Bus Namespace. Cannot be changed after the resource is created.
subscription.batched_operationsbooleanEnable support for batched operations for the Service Bus Subscription.
subscription.max_delivery_countintegerThe number if maximum deliveries, ranging 1-2000.
subscription.sessionbooleanService bus sessions allow ordered handling of unbounded sequences of related messages. Cannot be changed after the resource is created.
topic.batched_operationsbooleanEnable server-side batched operations for the Service Bus Topic.
topic.duplicate_detectionbooleanEnable duplicate detection for the Service Bus Topic. Cannot be changed after the resource is created.
topic.expressbooleanEnable express entities to hold messages in memory temporarily before writing them to persistent storage.
topic.support_orderingbooleanEnable ordering support for the Service Bus Topic.