'Events only for updating projection

We're introducing event sourcing and refactoring to a rich domain model in a part of our application and we're a little bit confused about a part.

We have Tanks, which are the aggregate root and we receive TankGauge information on those Thanks every so often. Since the historical gauging information is not relevant for any business logic, the aggregate doesn't hold a collection of all the gauges, it only has a reference to the most recent gauge.

To display the historical gauges, we do have a projection set up.

Now we're getting the request: we want to update remarks on a historical gauge. The only relevancy this has is on the projection that holds the historical gauges. This causes a situation in which applying the RemarkSetOnHistoricalGauge event on the aggregate is basically a no-op and only the projection will be updated accordingly.

This works but it feels counter a bit counter-intuitive. Any suggestions on this approach?



Solution 1:[1]

Capturing events as they happen in the external world is orthogonal to using the events to re-hydrate an aggregate. The fact that the aggregate does not map an event today is just happenstance, which could change over time. But capturing the event is a necessity.

As an aside, raising events that have no immediate relevance to the Aggregate but are valuable for projections is normal.

I have a similar example from my past. Our Identity domain listened to events published in the Email subdomain to raise EmailSent and EmailDelivered events within itself against emails sent earlier to a user. These events can sometimes arrive out of sequence if the user continues to use the website. The aggregate does not hold attributes to represent this information, but such events helped cross-check signups and conversions.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Subhash