0
0
Azurecloud~10 mins

Queue storage basics in Azure - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new queue client in Azure Storage.

Azure
from azure.storage.queue import QueueClient

queue_client = QueueClient.from_connection_string(conn_str=[1], queue_name="myqueue")
Drag options to blanks, or click blank then click option'
A"DefaultEndpointsProtocol=https;AccountName=account;AccountKey=key;EndpointSuffix=core.windows.net"
B12345
Cmyqueue
Dqueue_client
Attempts:
3 left
💡 Hint
Common Mistakes
Using the queue name instead of the connection string.
Using an integer instead of a string for the connection string.
2fill in blank
medium

Complete the code to send a message to the Azure queue.

Azure
queue_client.[1]("Hello, Azure!")
Drag options to blanks, or click blank then click option'
Asend_message
Breceive_message
Cdelete_message
Dcreate_queue
Attempts:
3 left
💡 Hint
Common Mistakes
Using receive_message instead of send_message.
Trying to create a queue instead of sending a message.
3fill in blank
hard

Fix the error in the code to receive a message from the queue.

Azure
messages = queue_client.[1](messages_per_page=1)
for msg in messages:
    print(msg.content)
Drag options to blanks, or click blank then click option'
Asend_message
Bpeek_messages
Creceive_messages
Ddelete_message
Attempts:
3 left
💡 Hint
Common Mistakes
Using send_message instead of receive_messages.
Using peek_messages which does not lock messages for processing.
4fill in blank
hard

Fill both blanks to delete a message after processing it.

Azure
messages = queue_client.receive_messages(messages_per_page=1)
for msg in messages:
    queue_client.[1](msg.message_id, msg.[2])
Drag options to blanks, or click blank then click option'
Adelete_message
Bmessage_id
Cpop_receipt
Dsend_message
Attempts:
3 left
💡 Hint
Common Mistakes
Using message_id alone to delete a message.
Trying to send a message instead of deleting it.
5fill in blank
hard

Fill all three blanks to create a queue, send a message, and then peek at the message.

Azure
queue_client.[1]()
queue_client.[2]("Test message")
peeked = queue_client.[3](messages_per_page=1)
for msg in peeked:
    print(msg.content)
Drag options to blanks, or click blank then click option'
Acreate_queue
Bsend_message
Cpeek_messages
Ddelete_message
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to peek before creating the queue.
Using delete_message instead of peek_messages.