Hi,

I tried using the Lifecycle interface to initialize Entity state, specifically to set a "created on" Date property, but I realized that Lifecycle is really of limited value in a system which uses EventSourcing, as we do.

The reason is that the entity itself is being created as a consequence of an event, which can either happen at the point that the command to the domain model is being processed, or much later during an event replay. In either case the resulting domain model state much be exactly the same, and if you're doing things in Lifecycle that is going to be tricky.

In my case I was setting a Date property to "new Date()". During command processing that would be fine, but during event replay that is entirely wrong, since the date must be what it was when the event to create the entity was generated.

So, for this reason the Lifecycle interface, although potentially very practical, is of limited use in an EventSourcing setup.

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to