

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Dead Letter
incomplete
2: Ack and Nack
incomplete
3: Dead Letter Queue
incomplete
4: Exact Delivery
incomplete
5: Nack Requeue
incomplete
6: Nack Requeue Fix
incomplete
This lesson's interactive features are locked, please to keep using them
So how does a consumer tell the message broker that an individual message succeeded or failed to be processed? When a consumer receives a message, it must acknowledge it.
If the subscriber crashes or fails to process the message, the message broker can just re-queue the message to be processed again, or discard it (perhaps to a dead-letter queue).
"Ack" is short for "acknowledge", and "Nack" is short for "negative acknowledge". There are really 3 options for acknowledging a message:
Acknowledge: Processed successfully.
Nack and requeue: Not processed successfully, but should be requeued on the same queue to be processed again (retry).
Nack and discard: Not processed successfully, and should be discarded (to a dead-letter queue if configured or just deleted entirely).
Ack
NackRequeue
NackDiscard
Ack: msg.Ack(false)
NackRequeue: msg.Nack(false, true)
NackDiscard: msg.Nack(false, false)
The move outcome was "safe"
Or, the move outcome was "make war"
The move outcome was "same player"
Or, the move outcome was anything else
Test the changes by running 2 clients: washington and napoleon. Have washington spawn a couple of units:
spawn americas artilleryHave napoleon spawn a unit:
spawn europe cavalryThen have washington move a unit into napoleon's territory:
move europe 1Napoleon's client should "Ack" the message, and Washington's client should "NackDiscard" the message. Make sure your logs reflect that. You can move on when you're satisfied with the results.
You might notice that nothing went to the dead-letter queue. That's because we haven't configured it yet, and that's okay.