selectively persist events

Since Axon 3.2 we have the ability to trigger replay using special API, without the need to delete tokens from DB.
Also, we have a control, what events would be applied during replay via @AllowReplay(boolean).

There are some kinds of events, which are by their nature only operational, they make sense only here and now, for example, the event causing sending sms/email. Hence, it obvious that there is no sense to persist such event because it makes no sense to replay it, it doesn’t cause a state change of any aggregate.

Does Axon provide controls over this? Probably I’m missing something, however, googling didn’t help.

In this it would make sense to have a special header as part of every event which is telling you that you are running in a replayed mode. Us just an idea.

Hi all,

For technical (non-business) events you could use a SimpleEventBus which does not persist events while publishing them. I’m not aware of a feature provided by Axon that supports selective event persistence. You are welcome to create an issue here in order for others to consider it.

Hope this helps!

Cheers,
Milan.

Thanks, it is exactly what I was looking for.

Could you also advice, what EventBus Axon uses on apply() method invocation?

середа, 29 серпня 2018 р. 11:27:14 UTC+3 користувач milan...@axoniq.io написав:

Hi everybody,

Well, we actually do have something like this in place!

Take a look at the FilteringEventStorageEngine.

This is a wrapper around another EventStorageEngine (thus JPA, JDBC or Mongo), which also takes in a Predicate.

In that predicate you can perform some decision making to ensure a given event is not store, but still propagated through your system.

I’d personally recommend using the FilteringEventStorageEngine and one way or another ‘tag’ your ‘operational events’.

The predicate can then look for that tag, that’s it.

Think about some form of event hierarchy, an interface, or a dedicated annotation as the tag.

Hope this helps you all out!

Cheers,

Steven

Hi Steven,

thank you! I like your approach the most. So now after applying FilteringEventStorageEngine I can explicitly annotate my events with @OperationalEvent and forget about persistance and replay questions, and moreover it can be explicitly logged why persistance skipped.

середа, 29 серпня 2018 р. 13:43:11 UTC+3 користувач Steven van Beelen написав: