Hi Andrey,
I strongly believe that CQRS has most value in larger “enterprise” applications.
The problem you describe is in my opinion not directly related with event sourcing, but more with pure CQRS. If you need information about the state of an aggregate, you do a query. If you want to change an aggregate, you use a command. One of the base principles of CQRS, is that there is no such thing as a single view on a domain model. In practice, that means that you can easily have multiple query databases that store the same information, but in different formats. One of these formats can be very useful to verify preconditions for executing commands.
In your example, a command handler would receive a “RegisterCustomerCommand”. Based on the information in that command, it will do a query to make sure that the customer does not already exist. If it already exists, the command handler either returns in silence, or it reports a failure (depending on your business case). If none is found, a new Customer aggregate is created, and stored in the command repository. From that, a “CustomerRegisteredEvent” is generated, which causes an entry in the query database to be created. Next time the same customer is created, it is found in the query database.
Depending on you architecture, it is (theoretically) possible that an aggregate is created twice, as the (optional) asynchronous nature of CQRS could cause a short delay between the generation of events and the query database being updated. If that really, really, really (always ask your domain expert three times
) is a problem, then you could decide to use a single aggregate that contains all the customers. The most important feature of an aggregate is that it maintains full consistency at all times.
In short, the response to the remark “CQRS/Event Sourcing is not suitable for enterprise applications” would be: it surely is, but it only requires you to look for solutions in a different way than when you use (e.g) a layered architecture. Some of these solutions might look weird at first, but once you get used to them, you notice their real potential.
The aspects I described above are also the main subject in the CQRS workshop I give at the end of next month. There is a link to the workshop page on www.axonframework.org with more information.
I hope this helps.
Cheers,
Allard