Skip to content
This repository was archived by the owner on Dec 7, 2018. It is now read-only.

Commit 3fcf37a

Browse files
authored
Merge pull request #62 from AxonFramework/filtering-event-storage-engine
Added Filtering Event Storage Engine chapter.
2 parents 67ed500 + 72cb667 commit 3fcf37a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

part-iv-advanced-tuning/advanced-customizations.md

+12
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,15 @@ public class MethodCommandHandlerDefinition implements HandlerEnhancerDefinition
131131

132132
To skip all handling of the handler then just throw an exception.
133133

134+
## Filtering Event Storage Engine
135+
In some scenarios you might want to chose which events to store. For this you can use the `FilteringEventStorageEngine`. One imaginable use case could be that we don't want to store non-domain events. `FilteringEventStorageEngine` uses a `Predicate<? super EventMessage<?>>` in order to filter events which get stored in the delegated engine. Let's try to configure a `FilteringEventStorageEngine` with the `Configurer` (if you are using Spring, it's enough to have a bean of type `EventStorageEngine` in your Application Context). The next example will only store domain events:
136+
```java
137+
public class EventStorageEngineConfiguration {
138+
139+
public void configureEventStorageEngine(Configurer configurer) {
140+
EventStorageEngine delegate = ...; // It does not matter for this example what storage engine you use
141+
142+
configurer.configureEmbeddedEventStore(c -> new FilteringEventStorageEngine(delegate, em -> em instanceof DomainEventMessage));
143+
}
144+
}
145+
```

0 commit comments

Comments
 (0)