diff --git a/audit-service/src/conf/config.json b/audit-service/src/conf/config.json index f0e431f..9cde165 100644 --- a/audit-service/src/conf/config.json +++ b/audit-service/src/conf/config.json @@ -1,4 +1,5 @@ { + "http.port": 36000, "url": "jdbc:hsqldb:file:audit-db;shutdown=true", "driverclass" : "org.hsqldb.jdbcDriver" } \ No newline at end of file diff --git a/audit-service/src/main/java/io/vertx/workshop/audit/impl/AuditVerticle.java b/audit-service/src/main/java/io/vertx/workshop/audit/impl/AuditVerticle.java index dd99bc1..68bf227 100644 --- a/audit-service/src/main/java/io/vertx/workshop/audit/impl/AuditVerticle.java +++ b/audit-service/src/main/java/io/vertx/workshop/audit/impl/AuditVerticle.java @@ -53,12 +53,11 @@ public void start(Future future) { readySingle.doOnSuccess(consumer -> { // on success we set the handler that will store message in the database consumer.handler(message -> storeInDatabase(message.body())); - }).subscribe(consumer -> { - // complete the verticle start with a success - future.complete(); - }, error -> { - // signal a verticle start failure - future.fail(error); + }).doOnSuccess(consumer -> { + // on success publish the audit endpoint for dashboard to consume + rxPublishHttpEndpoint("audit", "localhost", config().getInteger("http.port", 36000)) + .doOnSuccess(future::complete) + .doOnError(future::fail); }); }