Skip to content
Snippets Groups Projects
Commit 5fc07946 authored by Richard Alam's avatar Richard Alam
Browse files

- try to setup actor context

parent f5567ae9
No related branches found
No related tags found
No related merge requests found
......@@ -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)))
}
}
......
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)
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment