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

Commit 72cb667

Browse files
committed
Made some adjustments i.o. review remarks
Made some adjustments i.o. review remarks #47
1 parent 4afeb50 commit 72cb667

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,14 @@ public class MethodCommandHandlerDefinition implements HandlerEnhancerDefinition
132132
To skip all handling of the handler then just throw an exception.
133133

134134
## Filtering Event Storage Engine
135-
In cases when we want to chose which events to store, `FilteringEventStorageEngine` comes handy. One imaginable 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 `Configurer` (if you are using spring, it's enough to have a bean of type `EventStorageEngine` in your application context). This engine will store domain events only.
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:
136136
```java
137-
EventStorageEngine delegate = ...
138-
configurer.configureEmbeddedEventStore(c -> new FilteringEventStorageEngine(delegate, em -> em instanceof DomainEventMessage));
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+
}
139145
```

0 commit comments

Comments
 (0)