@Override public Router createRouter(Vertx vertx) { this.vertx = vertx; store = new RxStore(StoreFactory.createStore(vertx)); storagePath = vertx.getOrCreateContext().config() .getString(ConfigConstants.STORAGE_FILE_PATH); Router router = Router.router(vertx); router.get("/*").handler(this::onGet); router.put("/*").handler(this::onPut); router.post("/*").handler(this::onPost); router.delete("/*").handler(this::onDelete); return router; }
@Override public void start() { log.info("Launching importer ..."); store = new RxStore(StoreFactory.createStore(getVertx())); String storagePath = config().getString(ConfigConstants.STORAGE_FILE_PATH); incoming = storagePath + "/incoming"; vertx.eventBus().<JsonObject>localConsumer(AddressConstants.IMPORTER_IMPORT) .toObservable() .onBackpressureBuffer() // unlimited buffer .flatMapCompletable(msg -> { // call onImport() but ignore errors. onImport() will handle errors for us. return onImport(msg).onErrorComplete(); }, false, MAX_PARALLEL_IMPORTS) .subscribe(v -> { // ignore }, err -> { // This is bad. It will unsubscribe the consumer from the eventbus! // Should never happen anyhow. If it does, something else has // completely gone wrong. log.fatal("Could not import file", err); }); vertx.eventBus().localConsumer(AddressConstants.IMPORTER_PAUSE, this::onPause); }
.cast(MetaIndexerFactory.class)); store = new RxStore(StoreFactory.createStore(getVertx()));