On Jul 29, 1:01 am, Andrey Lomakin <
lomakin.and...@gmail.com> wrote:
> For example, one allowed to register customer only when last one doesn't
> exist, what is identified by according set of fields.
What would happen if a duplicate account is created?
Really what you're asking is "What would happen if a duplicate account
is created in the window of time that it takes the transaction side to
update the query side?" Or, how much development time do you want to
invest in the case where two people attempt to register the same
account within ~250ms.
The Yahoo DDD forum waxes philosophical about this as does the DDDCQRS
Google Group.
I'm pretty new to CQRS, but my decision was to make a database table
to enforce set constraints. I have a SetConstraint interface which has
one method checkAndInsert(scope,field,value). Scope may be 'system',
or finer grained (no duplicated accounts on the system, no duplicate
phone numbers in address book, etc). I have an InMemorySetConstraint
I inject for integration tests, and a DatabaseBackedSetConstraint I'm
planning on using in production.
Callers are *required* to check the query side first, then issue the
command. The domain uses the SetConstraint to ensure uniqueness; but
the database table could be emptied any time all the event and command
queues in the system are empty.
JAmes