Field not to be event sourced


If we dont want a particular field in the event to be event sourced (persist in the database), how can we achieve the same?

Thanks for your help.

Why do you want it to be part of the event, if you don’t want it to be persisted?

@Oliver_Libutzki - Yes, we want it to be part of the event because we have few event handlers looking for this specific field

And those event handlers are subscribing event handlers? If they are tracking event processors, the event needs to be stored before a tracking event handler can handle it.

What’s the exact field you do not want to store, @dbgsep09?

Axon’s default event processing strategy (so the query side of CQRS) uses a Streaming Processor. A streaming processor requires the use of a streaming event source. The EventStore in turn is a streaming event source. An EventBus is not a streaming event source (from Axon’s perspective).

So, if you need to handle that event carrying a given field, it should be persisted.
However, it is persisted in the event does not mean you need to use it in your Aggregate (the command side of CQRS). So, you do not require an event sourcing handler for every event and all fields. All you need inside your aggregate is the fields you require for business validation. The rest can all be disregarded, in fact.

This circles back to “what” you do not want to be stored. That might help out with deducing another way to resolve your problem.