diff --git a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/ApiService.scala b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/ApiService.scala index 2ee19fed1134b3e2b24da8004f131c3db6424173..b319edb9ec6281f032f0aebff747dc260ee5f59a 100755 --- a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/ApiService.scala +++ b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/ApiService.scala @@ -6,15 +6,16 @@ import akka.actor.ActorSystem import akka.http.scaladsl.server.Directives._ import akka.stream.Materializer import com.google.gson.Gson -import org.bigbluebutton.service.HealthzResponse +import org.bigbluebutton.service.{HealthzResponse, HealthzService} -class ApiService()(implicit executor: ExecutionContext, as: ActorSystem, mat: Materializer) { +class ApiService(healthz: HealthzService)(implicit executor: ExecutionContext, as: ActorSystem, mat: Materializer) { def routes = path("healthz") { get { + val resp = healthz.getHealthz() val gson = new Gson() - val response = new HealthzResponse("ok", "fine") + val response = new HealthzResponse(resp, "fine") complete(StatusCodes.ServiceUnavailable, HttpEntity(ContentTypes.`application/json`, gson.toJson(response))) } } diff --git a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/Boot.scala b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/Boot.scala index 3674178093b3a897aa5b951f9c25965967e49111..1f0c6dedeb1c95cd7bce3e30ed4d19de0ffb0516 100755 --- a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/Boot.scala +++ b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/Boot.scala @@ -1,15 +1,17 @@ package org.bigbluebutton import org.bigbluebutton.common2.bus.IncomingJsonMessageBus -import org.bigbluebutton.common2.redis.{ RedisConfig, RedisPublisher } +import org.bigbluebutton.common2.redis.{RedisConfig, RedisPublisher} import org.bigbluebutton.endpoint.redis.FSESLRedisSubscriberActor -import org.bigbluebutton.freeswitch.{ RxJsonMsgHdlrActor, VoiceConferenceService } +import org.bigbluebutton.freeswitch.{RxJsonMsgHdlrActor, VoiceConferenceService} import org.bigbluebutton.freeswitch.voice.FreeswitchConferenceEventListener -import org.bigbluebutton.freeswitch.voice.freeswitch.{ ConnectionManager, ESLEventListener, FreeswitchApplication } +import org.bigbluebutton.freeswitch.voice.freeswitch.{ConnectionManager, ESLEventListener, FreeswitchApplication} import org.freeswitch.esl.client.manager.DefaultManagerConnection import akka.actor.ActorSystem import akka.stream.ActorMaterializer import akka.http.scaladsl.Http +import org.bigbluebutton.service.HealthzService + import scala.concurrent.ExecutionContext object Boot extends App with SystemConfiguration with WebApi { @@ -60,7 +62,8 @@ object Boot extends App with SystemConfiguration with WebApi { "redis-subscriber" ) - val apiService = new ApiService() + val healthz = HealthzService()(system.) + val apiService = new ApiService(healthz) val bindingFuture = Http().bindAndHandle(apiService.routes, httpHost, httpPort) diff --git a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/service/HealthzService.scala b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/service/HealthzService.scala index 54a1b105496d008f6fb3cc55bb17d6ef9e813713..8c550c175f9306134ef448799201f8765f8f0c25 100755 --- a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/service/HealthzService.scala +++ b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/service/HealthzService.scala @@ -13,6 +13,10 @@ case class ToFSStatus(status: String) case class FromFsStatus(status: String) case object GetHealthStatus +object HealthzService { + def apply() (implicit context: ActorContext) = new HealthzService() +} + class HealthzService() (implicit val context: ActorContext, system: ActorSystem) { implicit def executionContext = system.dispatcher