use of org.folio.inventory.common.WebRequestDiagnostics 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);
}
use of org.folio.inventory.common.WebRequestDiagnostics in project mod-inventory by folio-org.
the class FailureInventoryStorageModule method start.
@Override
public void start(Promise deployed) {
server = vertx.createHttpServer();
Router router = Router.router(vertx);
server.requestHandler(router).listen(PORT_TO_USE, result -> {
if (result.succeeded()) {
System.out.printf("Starting failing storage module listening on %s%n", server.actualPort());
deployed.complete();
} else {
deployed.fail(result.cause());
}
});
router.route().handler(WebRequestDiagnostics::outputDiagnostics);
router.route("/server-error/item-storage/items*").handler(this::serverError);
router.route("/server-error/instance-storage/instances*").handler(this::serverError);
router.route("/server-error/authority-storage/authorities*").handler(this::serverError);
router.route("/bad-request/item-storage/items*").handler(this::badRequest);
router.route("/bad-request/instance-storage/instances*").handler(this::badRequest);
router.route("/bad-request/instance-storage/instances*").handler(this::badRequest);
router.route("/bad-request/authority-storage/authorities*").handler(this::badRequest);
}
Aggregations