diff --git a/src/main/java/com/epita/guereza/Main.java b/src/main/java/com/epita/guereza/Main.java index 498bf90..6b34c99 100644 --- a/src/main/java/com/epita/guereza/Main.java +++ b/src/main/java/com/epita/guereza/Main.java @@ -74,21 +74,16 @@ private static void runIndexer(Scope scope) { private static void runStore(Scope scope) { final Function newUrlStore = (s) -> new UrlStore(s.instanceOf(EventBusClient.class)); - final Function newRetroIndex = (s) -> new RetroIndex(); final Function 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)) + .register(new Singleton<>(RetroIndex.class, new RetroIndex())) + .register(new LazySingleton<>(EventStore.class, (s) -> new EventStore()) .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); + obj.addReducer(s.instanceOf(UrlStore.class)); + obj.addReducer(s.instanceOf(RetroIndex.class)); })) .register(new Prototype<>(App.class, newEventStoreApp)) .block(Main::runApp); diff --git a/src/main/java/com/epita/guereza/UrlStore.java b/src/main/java/com/epita/guereza/UrlStore.java index 5224f94..7431dc1 100644 --- a/src/main/java/com/epita/guereza/UrlStore.java +++ b/src/main/java/com/epita/guereza/UrlStore.java @@ -16,7 +16,7 @@ public class UrlStore implements Reducer { private static final Logger LOGGER = LoggerFactory.getLogger(CrawlerService.class); - private static final String STARTING_URL = "https://www.wikipedia.org"; + private static final String STARTING_URL = "http://www.wikipedia.org"; private final EventBusClient eventBus;