This is a theoretical question about the introduction of new BCs in a system we use ES and CQRS with DDD. So there won't be concrete examples.
There can be interesting problems by introducing new BC-s, which communicate with the old ones by receiving and publishing domain events. The root of these problems that we already have domain events in the event storage. When the new BC reacts on those old domain events it will do that in a way which is out of sync and/or out of sequence.
For example we have an old BC A
and we introduce a new BC B
. Both publish domain events which we call a
and b
. In the new system the order matters for example b1
must always come after a1
, but before a2
. What can we do, when we already have the a1
, a2
, a3
sequence in the event storage? Should we inject b1
after a1
and so on? Is this a viable solution by a huge event storage? It will certainly take a long time to replay all the old events one by one and react on them. How can we prevent sending an email to the customer by handling the newly created b1
event, which reacts on a 5 years old topic? Is there a pattern to prevent these kind of problems?