Service Bus is an enterprise message broker for commands and durable workflows. Event Grid routes discrete events from publishers to handlers. Event Hubs ingests high-throughput event streams for consumers that read partitioned logs. The right choice follows message meaning, delivery guarantees, throughput, ordering, replay, filtering, and consumer behavior.
A command asks a specific capability to do something. An event says something already happened. Mixing them produces unclear ownership and retry behavior.
Ways to build
Choose the Azure tool you want to use. The underlying resource stays the same.
Open Service Bus → Create namespace, choose tier, region, zone/network options, identity, encryption, and tags. Then create a queue or topic/subscription with TTL, lock duration, duplicate detection, sessions, max delivery count, and dead-letter behavior.
Exactly-once business outcomes normally require application idempotency, not faith in a transport label. Store a message or operation ID with the result.
Event Grid pushes events and retries according to its delivery policy. Use filters and dead-letter destinations. Handlers should return quickly, validate the event, and enqueue long work.
Event Hubs consumers track offsets/checkpoints per partition. Partition keys preserve order within a partition, not across the entire hub. Consumer groups provide independent views. Capture can write streams to storage for later analytics.
Use a versioned envelope with event ID, type, source, subject/entity, time, schema version, correlation/causation IDs, tenant where relevant, and data. Add optional fields compatibly. Avoid repurposing existing fields. Protect sensitive data because messages are copied to brokers, logs, dead letters, and analytics stores.
Bicep/Terraform should declare namespaces/topics/queues/hubs, authorization via RBAC, identities, private endpoints, DNS, diagnostic settings, dead-letter destinations, retention, capacity, and alerts. Premium/dedicated options have different network and throughput features. Check current tier matrices.