0
0
Microservicessystem_design~10 mins

Event replay in Microservices - Interactive Code Practice

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

Complete the code to start event replay from a specific offset.

Microservices
eventStream.replayFrom([1])
Drag options to blanks, or click blank then click option'
Aoffset
BeventType
Ctimestamp
DeventId
Attempts:
3 left
💡 Hint
Common Mistakes
Using eventId instead of offset causes replay to start incorrectly.
Using timestamp may cause replay to miss events.
2fill in blank
medium

Complete the code to store events for replay in a durable storage.

Microservices
eventStore.save([1])
Drag options to blanks, or click blank then click option'
AeventBatch
BeventHandler
CeventListener
DeventQueue
Attempts:
3 left
💡 Hint
Common Mistakes
Saving eventHandler instead of events causes no data to be stored.
Using eventQueue is for processing, not storage.
3fill in blank
hard

Fix the error in the replay function to avoid duplicate event processing.

Microservices
if (lastProcessedEventId !== [1]) {
  processEvent(event)
}
Drag options to blanks, or click blank then click option'
Aevent.payload
Bevent.timestamp
Cevent.type
Devent.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using event.timestamp causes duplicate events if timestamps are same.
Comparing event.type leads to skipping different events of same type.
4fill in blank
hard

Fill both blanks to filter and replay only specific event types.

Microservices
replayEvents.filter(event => event.[1] === [2])
Drag options to blanks, or click blank then click option'
Atype
B'UserCreated'
Cid
D'OrderPlaced'
Attempts:
3 left
💡 Hint
Common Mistakes
Filtering by 'id' instead of 'type' does not select event types.
Using wrong event type string filters no events.
5fill in blank
hard

Fill all three blanks to implement a replay with offset, batch size, and event handler.

Microservices
eventStream.replayFrom([1]).batch([2]).onEvent([3])
Drag options to blanks, or click blank then click option'
Aoffset
BbatchSize
ChandleEvent
DeventType
Attempts:
3 left
💡 Hint
Common Mistakes
Using eventType instead of batchSize causes errors in batch processing.
Omitting the event handler causes no events to be processed.