0
0
Microservicessystem_design~10 mins

Why events decouple services in Microservices - 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 an event helps services communicate without direct calls.

Microservices
serviceA.publish([1])
Drag options to blanks, or click blank then click option'
A"OrderCreatedEvent"
B"SynchronousRequest"
C"DirectCall"
D"TightlyCoupledCall"
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing direct or synchronous calls which tightly couple services.
2fill in blank
medium

Complete the code to show how a service listens for an event to react asynchronously.

Microservices
eventBus.subscribe("OrderCreatedEvent", [1])
Drag options to blanks, or click blank then click option'
AhandleOrderCreated
BcallServiceDirectly
CsendSyncRequest
DblockUntilResponse
Attempts:
3 left
💡 Hint
Common Mistakes
Using direct calls or blocking functions which reduce decoupling.
3fill in blank
hard

Fix the error in the code to properly decouple services using events.

Microservices
serviceB.processOrder()  # Incorrect direct call
serviceA.[1](orderData)  # Correct event publish
Drag options to blanks, or click blank then click option'
AcallDirectly
BinvokeService
CpublishEvent
DsendSyncRequest
Attempts:
3 left
💡 Hint
Common Mistakes
Keeping direct calls which tightly couple services.
4fill in blank
hard

Fill both blanks to complete the event-driven communication pattern.

Microservices
eventBus.[1]("PaymentProcessed", [2])
Drag options to blanks, or click blank then click option'
Apublish
BhandlePayment
Csubscribe
DsendRequest
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up publish and subscribe methods.
5fill in blank
hard

Fill all three blanks to complete the event-driven service interaction.

Microservices
serviceA.[1]("UserRegistered", data)

serviceB.[2]("UserRegistered", [3])
Drag options to blanks, or click blank then click option'
Aemit
Bsubscribe
ChandleUserRegistration
DcallDirectly
Attempts:
3 left
💡 Hint
Common Mistakes
Using direct calls instead of events.