0
0
HLDsystem_design~10 mins

Why async processing decouples systems in HLD - Test Your Understanding

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

Complete the code to show how a message queue helps decouple services.

HLD
service.send_message_to_queue([1])
Drag options to blanks, or click blank then click option'
Arequest_data
Bresponse_data
Cerror_log
Dsync_call
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing response_data or error_log which are not sent to the queue for processing.
2fill in blank
medium

Complete the code to show how the consumer processes messages asynchronously.

HLD
while True:
    message = queue.[1]()
    process(message)
Drag options to blanks, or click blank then click option'
Aacknowledge
Bsend
Cdelete
Dreceive
Attempts:
3 left
💡 Hint
Common Mistakes
Using send or delete which are not for receiving messages.
3fill in blank
hard

Fix the error in the code to ensure the producer does not wait for the consumer.

HLD
producer.send_request()
producer.[1]()  # Should not wait for response
Drag options to blanks, or click blank then click option'
Aprocess_response
Bcontinue_processing
Cwait_for_response
Dblock
Attempts:
3 left
💡 Hint
Common Mistakes
Using wait_for_response or block which cause synchronous waiting.
4fill in blank
hard

Fill both blanks to complete the asynchronous message handling code.

HLD
message = queue.[1]()
if message is not None:
    [2](message)
Drag options to blanks, or click blank then click option'
Areceive
Bsend
Cprocess
Ddelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using send instead of receive or delete instead of process.
5fill in blank
hard

Fill all three blanks to implement asynchronous task submission and handling.

HLD
def submit_task(task):
    queue.[1](task)

def worker():
    while True:
        task = queue.[2]()
        if task:
            [3](task)
Drag options to blanks, or click blank then click option'
Asend
Breceive
Cprocess
Dwait
Attempts:
3 left
💡 Hint
Common Mistakes
Using wait which blocks, or mixing send and receive incorrectly.