Command not changing aggregate state - ignore? (best practice)

What is good practice if I recieve command that is not changing anything on current aggregate state, but don’t break any business rule?

e.g. if I receive ChangeFirstNameCommand(“userId”, “newName”) on the user aggregate but “newName” is current value - should I apply corresponding event (event if it don´t bring any new information, only “spam” the aggregate), or ignore it (which bring additional check of aggregate state)?

Hey Lukas, in my opinion its really a decision in how you want to implement your domain logic. I am used to do a check for differences in the command handler and don’t apply any events, if nothing changed, so make the command “idempotent”. Another idea, if suitable for your domain, would be to throw an exception if nothing changed and the command is somehow “useless”.

But then you should have all data in your aggregate state, without them you can´t check if anything changed. And condition before each apply. And it seems to be quite complicated. But probably it is a must :slight_smile: