diff options
Diffstat (limited to 'hv-collector-health-check')
-rw-r--r-- | hv-collector-health-check/pom.xml | 4 | ||||
-rw-r--r-- | hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt | 24 |
2 files changed, 16 insertions, 12 deletions
diff --git a/hv-collector-health-check/pom.xml b/hv-collector-health-check/pom.xml index 45fa2e04..6ecdc95b 100644 --- a/hv-collector-health-check/pom.xml +++ b/hv-collector-health-check/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> <relativePath>..</relativePath> </parent> @@ -50,7 +50,7 @@ <artifactId>kotlin-stdlib-jdk8</artifactId> </dependency> <dependency> - <groupId>io.projectreactor.ipc</groupId> + <groupId>io.projectreactor.netty</groupId> <artifactId>reactor-netty</artifactId> </dependency> <dependency> diff --git a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt index 753f73ef..b4d7c142 100644 --- a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt +++ b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt @@ -27,26 +27,30 @@ import org.onap.dcae.collectors.veshv.utils.NettyServerHandle import org.onap.dcae.collectors.veshv.utils.ServerHandle import reactor.core.publisher.Flux import reactor.core.publisher.Mono -import reactor.ipc.netty.http.server.HttpServer -import reactor.ipc.netty.http.server.HttpServerRequest -import reactor.ipc.netty.http.server.HttpServerResponse +import reactor.netty.http.server.HttpServer +import reactor.netty.http.server.HttpServerRequest +import reactor.netty.http.server.HttpServerResponse +import java.net.SocketAddress import java.util.concurrent.atomic.AtomicReference /** * @author Jakub Dudycz <jakub.dudycz@nokia.com> * @since August 2018 */ -class HealthCheckApiServer(private val healthState: HealthState, private val port: Int) { +class HealthCheckApiServer(private val healthState: HealthState, + private val listenAddress: SocketAddress) { private val healthDescription: AtomicReference<HealthDescription> = AtomicReference(HealthDescription.STARTING) fun start(): IO<ServerHandle> = IO { healthState().subscribe(healthDescription::set) - val ctx = HttpServer.create(port).startRouter { routes -> - routes.get("/health/ready", ::readinessHandler) - routes.get("/health/alive", ::livenessHandler) - } - NettyServerHandle(ctx) + val ctx = HttpServer.create() + .tcpConfiguration { it.addressSupplier { listenAddress } } + .route { routes -> + routes.get("/health/ready", ::readinessHandler) + routes.get("/health/alive", ::livenessHandler) + } + NettyServerHandle(ctx.bindNow()) } private fun readinessHandler(req: HttpServerRequest, resp: HttpServerResponse) = @@ -55,6 +59,6 @@ class HealthCheckApiServer(private val healthState: HealthState, private val por } private fun livenessHandler(req: HttpServerRequest, resp: HttpServerResponse) = - resp.status(HttpResponseStatus.NOT_IMPLEMENTED).sendString(Mono.just("Not implemented yet")) + resp.status(HttpResponseStatus.NOT_IMPLEMENTED).sendString(Mono.just("Not implemented yet")) } |