I'm currently using Event Driven Architecture in microservices. I have one question related to event based systems:
For example, suppose I have a Person model which reacts to ProfileChangeEvent(contains the name that the Person need to update with). Now I have the following situation in steps:
- Change profile name to 'Mike' and publish ProfileChangeEvent with name='Mike'
- Change profile name again to 'Micheal' and publish ProfileChangeEvent with name='Michael'
- The 2 events gets arrived in correct order but the first event handling failed and the event end up in the Dead Letter Queue(DLQ), eventually the Person's name is 'Michael' as the second event consumption succeed.
- After some time I noticed that first failing event in the DLQ and republish it and the consumption succeed, now the Person's name is 'Mike' which is not correct as 'Michael' is actually the more recent updated value.
Please provide advice on how to deal with such situations?