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:
msg.Ack(false)msg.Nack(false, true)msg.Nack(false, false)Test the changes by running 2 clients: washington and napoleon. Have washington spawn a couple of units:
spawn americas artillery
Have napoleon spawn a unit:
spawn europe cavalry
Then have washington move a unit into napoleon's territory:
move europe 1
Napoleon'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.
Become a member to Complete
Become a member to view solution