use of io.georocket.storage.RxStore in project georocket by georocket.
the class ImporterVerticle method start.
@Override
public void start() {
log.info("Launching importer ...");
reportActivities = config().getBoolean(ConfigConstants.REPORT_ACTIVITIES, false);
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().flatMapSingle(msg -> {
// call onImport() but ignore errors. onImport() will handle errors for us.
return onImport(msg).onErrorReturn(err -> null);
}, 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);
});
}
use of io.georocket.storage.RxStore in project georocket by georocket.
the class IndexerVerticle method start.
@Override
public void start(Future<Void> startFuture) {
// True if the indexer and other verticles should report their activities
// to the Vert.x event bus (mostly useful for GeoRocket plug-ins)
reportActivities = config().getBoolean(ConfigConstants.REPORT_ACTIVITIES, false);
maxBulkSize = config().getInteger(ConfigConstants.INDEX_MAX_BULK_SIZE, ConfigConstants.DEFAULT_INDEX_MAX_BULK_SIZE);
maxParallelInserts = config().getInteger(ConfigConstants.INDEX_MAX_PARALLEL_INSERTS, ConfigConstants.DEFAULT_INDEX_MAX_PARALLEL_INSERTS);
// load and copy all indexer factories now and not lazily to avoid
// concurrent modifications to the service loader's internal cache
indexerFactories = ImmutableList.copyOf(ServiceLoader.load(IndexerFactory.class));
xmlIndexerFactories = ImmutableList.copyOf(Seq.seq(indexerFactories).filter(f -> f instanceof XMLIndexerFactory).cast(XMLIndexerFactory.class));
jsonIndexerFactories = ImmutableList.copyOf(Seq.seq(indexerFactories).filter(f -> f instanceof JsonIndexerFactory).cast(JsonIndexerFactory.class));
metaIndexerFactories = ImmutableList.copyOf(Seq.seq(indexerFactories).filter(f -> f instanceof MetaIndexerFactory).cast(MetaIndexerFactory.class));
store = new RxStore(StoreFactory.createStore(getVertx()));
queryCompiler = createQueryCompiler();
queryCompiler.setQueryCompilers(indexerFactories);
new ElasticsearchClientFactory(vertx).createElasticsearchClient(INDEX_NAME).doOnNext(es -> {
client = es;
}).flatMap(v -> client.ensureIndex()).flatMap(v -> ensureMapping()).subscribe(es -> {
registerMessageConsumers();
startFuture.complete();
}, err -> {
startFuture.fail(err);
});
}
Aggregations