Search in sources :

Example 1 with InstancesBatch

use of org.folio.inventory.resources.InstancesBatch in project mod-inventory by folio-org.

the class InventoryVerticle method start.

@Override
public void start(Promise<Void> started) {
    Logging.initialiseFormat();
    final Logger log = LogManager.getLogger(MethodHandles.lookup().lookupClass());
    Router router = Router.router(vertx);
    server = vertx.createHttpServer();
    JsonObject config = vertx.getOrCreateContext().config();
    log.info("Received Config");
    config.fieldNames().forEach(key -> log.info(String.format("%s:%s", key, config.getValue(key).toString())));
    HttpClient client = vertx.createHttpClient();
    Storage storage = Storage.basedUpon(vertx, config, client);
    new IngestMessageProcessor(storage).register(vertx.eventBus());
    router.route().handler(WebRequestDiagnostics::outputDiagnostics);
    new ModsIngestion(storage, client).register(router);
    new Items(storage, client).register(router);
    new MoveApi(storage, client).register(router);
    new Instances(storage, client).register(router);
    new Holdings(storage).register(router);
    new InstancesBatch(storage, client).register(router);
    new IsbnUtilsApi().register(router);
    new ItemsByHoldingsRecordId(storage, client).register(router);
    new InventoryConfigApi().register(router);
    new TenantApi().register(router);
    Handler<AsyncResult<HttpServer>> onHttpServerStart = result -> {
        if (result.succeeded()) {
            log.info(String.format("Listening on %s", server.actualPort()));
            started.complete();
        } else {
            started.fail(result.cause());
        }
    };
    server.requestHandler(router).listen(config.getInteger("port"), onHttpServerStart);
}
Also used : WebRequestDiagnostics(org.folio.inventory.common.WebRequestDiagnostics) PostgresClientFactory(org.folio.inventory.common.dao.PostgresClientFactory) HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router) InstancesBatch(org.folio.inventory.resources.InstancesBatch) TenantApi(org.folio.inventory.resources.TenantApi) Instances(org.folio.inventory.resources.Instances) IsbnUtilsApi(org.folio.inventory.resources.IsbnUtilsApi) Holdings(org.folio.inventory.resources.Holdings) Items(org.folio.inventory.resources.Items) JsonObject(io.vertx.core.json.JsonObject) ModsIngestion(org.folio.inventory.resources.ingest.ModsIngestion) AsyncResult(io.vertx.core.AsyncResult) MoveApi(org.folio.inventory.resources.MoveApi) Promise(io.vertx.core.Promise) MethodHandles(java.lang.invoke.MethodHandles) ItemsByHoldingsRecordId(org.folio.inventory.resources.ItemsByHoldingsRecordId) InventoryConfigApi(org.folio.inventory.resources.InventoryConfigApi) Storage(org.folio.inventory.storage.Storage) Logger(org.apache.logging.log4j.Logger) AbstractVerticle(io.vertx.core.AbstractVerticle) IngestMessageProcessor(org.folio.inventory.domain.ingest.IngestMessageProcessor) Handler(io.vertx.core.Handler) LogManager(org.apache.logging.log4j.LogManager) HttpClient(io.vertx.core.http.HttpClient) Router(io.vertx.ext.web.Router) JsonObject(io.vertx.core.json.JsonObject) ItemsByHoldingsRecordId(org.folio.inventory.resources.ItemsByHoldingsRecordId) WebRequestDiagnostics(org.folio.inventory.common.WebRequestDiagnostics) IsbnUtilsApi(org.folio.inventory.resources.IsbnUtilsApi) Logger(org.apache.logging.log4j.Logger) IngestMessageProcessor(org.folio.inventory.domain.ingest.IngestMessageProcessor) Instances(org.folio.inventory.resources.Instances) InstancesBatch(org.folio.inventory.resources.InstancesBatch) TenantApi(org.folio.inventory.resources.TenantApi) Storage(org.folio.inventory.storage.Storage) Holdings(org.folio.inventory.resources.Holdings) HttpClient(io.vertx.core.http.HttpClient) Items(org.folio.inventory.resources.Items) ModsIngestion(org.folio.inventory.resources.ingest.ModsIngestion) AsyncResult(io.vertx.core.AsyncResult) MoveApi(org.folio.inventory.resources.MoveApi) InventoryConfigApi(org.folio.inventory.resources.InventoryConfigApi)

Aggregations

AbstractVerticle (io.vertx.core.AbstractVerticle)1 AsyncResult (io.vertx.core.AsyncResult)1 Handler (io.vertx.core.Handler)1 Promise (io.vertx.core.Promise)1 HttpClient (io.vertx.core.http.HttpClient)1 HttpServer (io.vertx.core.http.HttpServer)1 JsonObject (io.vertx.core.json.JsonObject)1 Router (io.vertx.ext.web.Router)1 MethodHandles (java.lang.invoke.MethodHandles)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 WebRequestDiagnostics (org.folio.inventory.common.WebRequestDiagnostics)1 PostgresClientFactory (org.folio.inventory.common.dao.PostgresClientFactory)1 IngestMessageProcessor (org.folio.inventory.domain.ingest.IngestMessageProcessor)1 Holdings (org.folio.inventory.resources.Holdings)1 Instances (org.folio.inventory.resources.Instances)1 InstancesBatch (org.folio.inventory.resources.InstancesBatch)1 InventoryConfigApi (org.folio.inventory.resources.InventoryConfigApi)1 IsbnUtilsApi (org.folio.inventory.resources.IsbnUtilsApi)1 Items (org.folio.inventory.resources.Items)1