0
0
Microservicessystem_design~10 mins

Event-driven vs request-driven in Microservices - Interactive Practice

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

Complete the code to identify the type of communication where a service sends a message and continues without waiting.

Microservices
if communication_type == '[1]':
    print("Service sends event and moves on")
Drag options to blanks, or click blank then click option'
Aevent-driven
Brequest-driven
Csynchronous
Dblocking
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing event-driven with request-driven communication
Thinking synchronous means no waiting
2fill in blank
medium

Complete the code to describe the communication style where a service waits for a response after sending a request.

Microservices
if communication_type == '[1]':
    print("Service sends request and waits for reply")
Drag options to blanks, or click blank then click option'
Aasynchronous
Bevent-driven
Cfire-and-forget
Drequest-driven
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up asynchronous event-driven with synchronous request-driven
Assuming event-driven always waits for a response
3fill in blank
hard

Fix the error in the code that wrongly treats event-driven communication as synchronous.

Microservices
def send_message():
    response = send_event()  # [1] call
    print("Continue processing")
Drag options to blanks, or click blank then click option'
Ablocking
Basynchronous
Csynchronous
Ddirect
Attempts:
3 left
💡 Hint
Common Mistakes
Using synchronous or blocking calls for event-driven communication
Assuming all calls wait for a response
4fill in blank
hard

Fill both blanks to complete the description of event-driven and request-driven communication.

Microservices
Event-driven communication is [1], while request-driven communication is [2].
Drag options to blanks, or click blank then click option'
Aasynchronous
Bsynchronous
Cblocking
Dfire-and-forget
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping asynchronous and synchronous terms
Confusing blocking with asynchronous
5fill in blank
hard

Fill all three blanks to complete the code that models a microservice handling both communication styles.

Microservices
def handle_communication(type):
    if type == '[1]':
        send_event()  # [2] call
    elif type == '[3]':
        send_request()  # waits for response
Drag options to blanks, or click blank then click option'
Aevent-driven
Basynchronous
Crequest-driven
Dsynchronous
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up event-driven and request-driven labels
Using synchronous for event-driven calls