-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Hi,
Given I use event sourcing for a online shop with a Product aggregate. A product has events like:
ProductCreated (playhead 1) → ProductTitleChanged (playhead 2) → ProductPriceChanged (playhead 3)
and attribute events like:
AttributeCreated (playhead 4) → AttributeChanged (playhead 5) → …
Now I want to create ProductVariant aggregate that starts with the product’s state at a specific point in time, but maintain an independent event stream afterwards based on the "parent" event-stream.
Creating a variant requires either:
Duplicating all product events into the variant stream, or storing full state of all previous events in one single "import event" (which turns events into state records and complicates evolution)
I would like to suggest a feature to “fork” an event-stream based on a specific event-stream and playhead number.
Imagine the scenario above.
Based on this event-stream from the product I would create a new Product Variant with one event ProductVariantCreated.
Now I want all the events from the base product in my product variant and only the adjustments which I make in the variant should be in the product variant stream.
When I apply a new event in the base product, the variant product should not be touched, because the variant is based on a specific playhead from the stream. Only if I explicitly configure it (maybe via an attribute on the event like the SplitStream Attribute) I want to re-apply all events from the base product.
What do you think about the idea? Do you see problems with using the approach of using simply a "import event", which duplicates the data from the "parent" stream? In my opinion based on the size of the event-stream this could end up in a lot of redundant data in the event-store.