Complete the code to identify the type of communication where a service sends a message and continues without waiting.
if communication_type == '[1]': print("Service sends event and moves on")
In event-driven communication, the service sends an event and continues without waiting for a response.
Complete the code to describe the communication style where a service waits for a response after sending a request.
if communication_type == '[1]': print("Service sends request and waits for reply")
Request-driven communication involves sending a request and waiting for a response, typically synchronous.
Fix the error in the code that wrongly treats event-driven communication as synchronous.
def send_message(): response = send_event() # [1] call print("Continue processing")
Event-driven communication is asynchronous, so the call should be asynchronous, not synchronous.
Fill both blanks to complete the description of event-driven and request-driven communication.
Event-driven communication is [1], while request-driven communication is [2].
Event-driven is asynchronous (non-blocking), request-driven is synchronous (blocking).
Fill all three blanks to complete the code that models a microservice handling both communication styles.
def handle_communication(type): if type == '[1]': send_event() # [2] call elif type == '[3]': send_request() # waits for response
Event-driven uses asynchronous calls; request-driven uses synchronous calls.