Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Commit

Permalink
Connect reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
dethi committed Dec 9, 2017
1 parent e24899e commit 7d90898
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/com/epita/guereza/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,22 @@ private static void runIndexer(Scope scope) {

private static void runStore(Scope scope) {
final Function<Scope, UrlStore> newUrlStore = (s) -> new UrlStore(s.instanceOf(EventBusClient.class));
final Function<Scope, RetroIndex> newRetroIndex = (s) -> new RetroIndex();
final Function<Scope, App> newEventStoreApp = (s) -> new EventStoreApp(
s.instanceOf(EventBusClient.class), s.instanceOf(EventStore.class));

scope.scope()
.register(new Singleton<>(EventStore.class, new EventStore()))
.register(new LazySingleton<>(UrlStore.class, newUrlStore))
.register(new LazySingleton<>(UrlStore.class, newUrlStore)
.afterCreate((s, obj) -> {
EventStore eventStore = s.instanceOf(EventStore.class);
eventStore.addReducer(obj);
}))
.register(new LazySingleton<>(RetroIndex.class, newRetroIndex)
.afterCreate((s, obj) -> {
EventStore eventStore = s.instanceOf(EventStore.class);
eventStore.addReducer(obj);
}))
.register(new Prototype<>(App.class, newEventStoreApp))
.block(Main::runApp);
}
Expand Down

0 comments on commit 7d90898

Please sign in to comment.