Bird
Raised Fist0
Azurecloud~10 mins

Event Grid vs Service Bus decision in Azure - Interactive Practice

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create an Event Grid subscription that listens to events from a storage account.

Azure
az eventgrid event-subscription create --name mySub --source-resource-id /subscriptions/123/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/myStorage [1] --endpoint https://myendpoint.com/api/events
Drag options to blanks, or click blank then click option'
A--endpoint-type queue
B--endpoint-type eventhub
C--endpoint-type topic
D--endpoint-type webhook
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing Event Hub or queue as endpoint type for Event Grid subscription.
2fill in blank
medium

Complete the code to create a Service Bus queue with a lock duration of 45 seconds.

Azure
az servicebus queue create --resource-group myRG --namespace-name myNamespace --name myQueue --lock-duration [1]
Drag options to blanks, or click blank then click option'
APT45S
BPT60S
CPT30S
DPT90S
Attempts:
3 left
💡 Hint
Common Mistakes
Using plain numbers instead of ISO 8601 duration format.
3fill in blank
hard

Fix the error in the code to send a message to a Service Bus queue using Azure CLI.

Azure
az servicebus queue send --resource-group myRG --namespace-name myNamespace --name myQueue --message-body [1]
Drag options to blanks, or click blank then click option'
AHello World
B'Hello World'
C"Hello World"
D'HelloWorld'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the message body, causing CLI errors.
4fill in blank
hard

Fill both blanks to configure a Service Bus topic subscription with a SQL filter to receive only messages where the property 'priority' is 'high'.

Azure
az servicebus topic subscription create --resource-group myRG --namespace-name myNamespace --topic-name myTopic --name mySub --[1] "[2]"
Drag options to blanks, or click blank then click option'
Asql-filter
Bfilter-sql-filter
Cpriority = 'high'
Dpriority == 'high'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'filter-sql-filter' which is not a valid parameter.
Using '==' instead of '=' in the SQL expression.
5fill in blank
hard

Fill all three blanks to create an Event Grid subscription that filters events by subject prefix and sends them to a Service Bus queue.

Azure
az eventgrid event-subscription create --name mySub --source-resource-id /subscriptions/123/resourceGroups/myRG/providers/Microsoft.Storage/storageAccounts/myStorage --endpoint-type [1] --endpoint /subscriptions/123/resourceGroups/myRG/providers/Microsoft.ServiceBus/namespaces/myNamespace/queues/[2] --subject-begins-with [3]
Drag options to blanks, or click blank then click option'
Aqueue
BmyQueue
C/blobServices/default/containers/images/
Dtopic
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'topic' as endpoint type when targeting a queue.
Incorrect subject prefix format.

Practice

(1/5)
1. Which Azure service is best suited for lightweight, event-driven notifications that require minimal setup?
easy
A. Service Bus
B. Azure Functions
C. Event Grid
D. Azure Logic Apps

Solution

  1. Step 1: Understand the purpose of Event Grid

    Event Grid is designed for lightweight, event-driven notifications with simple event routing.
  2. Step 2: Compare with Service Bus

    Service Bus is more complex and used for reliable, ordered messaging, not just simple notifications.
  3. Final Answer:

    Event Grid -> Option C
  4. Quick Check:

    Lightweight event notifications = Event Grid [OK]
Hint: Lightweight events? Think Event Grid first. [OK]
Common Mistakes:
  • Confusing Service Bus with Event Grid for simple notifications
  • Choosing Azure Functions or Logic Apps as messaging services
2. Which of the following is the correct way to create a Service Bus queue using Azure CLI?
easy
A. az servicebus queue create --resource-group MyGroup --namespace-name MyNamespace --name MyQueue
B. az eventgrid queue create --resource-group MyGroup --name MyQueue
C. az servicebus topic create --resource-group MyGroup --name MyQueue
D. az storage queue create --resource-group MyGroup --name MyQueue

Solution

  1. Step 1: Identify the correct Azure CLI command for Service Bus queue

    The command to create a Service Bus queue includes 'az servicebus queue create' with resource group, namespace, and queue name.
  2. Step 2: Eliminate incorrect commands

    Options B and D refer to Event Grid and Storage queues, not Service Bus. az servicebus topic create --resource-group MyGroup --name MyQueue creates a topic, not a queue.
  3. Final Answer:

    az servicebus queue create --resource-group MyGroup --namespace-name MyNamespace --name MyQueue -> Option A
  4. Quick Check:

    Service Bus queue creation uses 'az servicebus queue create' [OK]
Hint: Service Bus queue uses 'az servicebus queue create' command. [OK]
Common Mistakes:
  • Using Event Grid or Storage queue commands for Service Bus
  • Confusing topics with queues in Service Bus
3. Given the following scenario: An application needs to process messages in order and guarantee delivery even if the receiver is temporarily offline. Which Azure service behavior matches this requirement?
medium
A. Service Bus queues guarantee ordered delivery and support message retries.
B. Service Bus does not support message ordering.
C. Event Grid stores messages until the receiver is online.
D. Event Grid delivers events immediately but does not guarantee order or retries.

Solution

  1. Step 1: Analyze delivery guarantees needed

    The app needs ordered delivery and guaranteed processing even if offline, which requires message durability and retries.
  2. Step 2: Match with service features

    Service Bus queues support ordered delivery and message retries, ensuring reliable processing.
  3. Final Answer:

    Service Bus queues guarantee ordered delivery and support message retries. -> Option A
  4. Quick Check:

    Ordered, reliable delivery = Service Bus queues [OK]
Hint: Ordered, reliable messages? Choose Service Bus queues. [OK]
Common Mistakes:
  • Assuming Event Grid guarantees order and retries
  • Believing Service Bus lacks ordering support
4. You have an Event Grid subscription that is not receiving events as expected. Which of the following is the most likely cause?
medium
A. The Service Bus topic is not configured with sessions.
B. The Service Bus queue is full and blocking events.
C. The Event Grid topic does not support message ordering.
D. The Event Grid subscription endpoint URL is incorrect or unreachable.

Solution

  1. Step 1: Identify common Event Grid delivery issues

    Event Grid requires a valid, reachable endpoint URL for subscriptions to receive events.
  2. Step 2: Eliminate unrelated causes

    Service Bus queue full or topic session settings do not affect Event Grid subscriptions directly.
  3. Final Answer:

    The Event Grid subscription endpoint URL is incorrect or unreachable. -> Option D
  4. Quick Check:

    Event Grid needs reachable endpoint URL [OK]
Hint: Check endpoint URL if Event Grid events don't arrive. [OK]
Common Mistakes:
  • Blaming Service Bus settings for Event Grid issues
  • Ignoring endpoint URL correctness
5. A company wants to build a system that processes thousands of events per second with minimal latency, but also requires guaranteed message delivery and ordering for critical workflows. Which combination of Azure services should they use?
hard
A. Use Event Grid for all events because it is fast and supports guaranteed ordering.
B. Use Event Grid for high-volume lightweight events and Service Bus for critical ordered workflows.
C. Use Service Bus for all events because it supports ordering but may have higher latency.
D. Use Azure Storage Queues for all messaging needs.

Solution

  1. Step 1: Analyze requirements for speed and reliability

    The system needs both high throughput with low latency and guaranteed delivery with ordering for some workflows.
  2. Step 2: Match services to needs

    Event Grid handles high-volume, lightweight events quickly but lacks ordering guarantees. Service Bus supports ordering and reliability but with some latency.
  3. Step 3: Combine services for best fit

    Using Event Grid for fast, lightweight events and Service Bus for critical ordered workflows balances speed and reliability.
  4. Final Answer:

    Use Event Grid for high-volume lightweight events and Service Bus for critical ordered workflows. -> Option B
  5. Quick Check:

    Mix Event Grid speed + Service Bus reliability [OK]
Hint: Combine Event Grid speed with Service Bus reliability. [OK]
Common Mistakes:
  • Expecting Event Grid to guarantee ordering
  • Using only Service Bus and ignoring latency needs
  • Choosing Storage Queues which lack advanced features