Skip to content

Commit

Permalink
Moved akka-transcode messages to 2.0 format
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobmarin committed Jul 25, 2017
1 parent 20fe7c2 commit d50f65f
Show file tree
Hide file tree
Showing 39 changed files with 558 additions and 902 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ class BigBlueButtonActor(
val disconnectEvnt = MsgBuilder.buildDisconnectAllClientsSysMsg(msg.body.meetingId)
outGW.send(disconnectEvnt)

val stopTranscodersCmd = MsgBuilder.buildStopMeetingTranscodersSysCmdMsg(msg.body.meetingId)
outGW.send(stopTranscodersCmd)

log.info("Destroyed meetingId={}", msg.body.meetingId)
val destroyedEvent = MsgBuilder.buildMeetingDestroyedEvtMsg(msg.body.meetingId)
outGW.send(destroyedEvent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import scala.concurrent.duration._
import org.bigbluebutton.core.pubsub.senders.UsersMessageToJsonConverter
import org.bigbluebutton.common.messages.UserEjectedFromMeetingMessage
import org.bigbluebutton.common.converters.ToJsonEncoder
import org.bigbluebutton.common.messages.StopMeetingTranscodersMessage
import scala.collection.JavaConverters

object MessageSenderActor {
Expand Down Expand Up @@ -280,11 +279,6 @@ class MessageSenderActor(val service: MessageSender)
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
}

private def handleStopMeetingTranscoders(msg: StopMeetingTranscoders) {
val smt = new StopMeetingTranscodersMessage(msg.meetingID)
service.send(MessagingConstants.TO_BBB_TRANSCODE_SYSTEM_CHAN, smt.toJson())
}

private def handleGetGuestPolicyReply(msg: GetGuestPolicyReply) {
val json = UsersMessageToJsonConverter.getGuestPolicyReplyToJson(msg)
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,14 @@ object MsgBuilder {

BbbCommonEnvCoreMsg(envelope, event)
}

def buildStopMeetingTranscodersSysCmdMsg(meetingId: String): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
val envelope = BbbCoreEnvelope(StopMeetingTranscodersSysCmdMsg.NAME, routing)
val body = StopMeetingTranscodersSysCmdMsgBody()
val header = BbbCoreHeaderWithMeetingId(StopMeetingTranscodersSysCmdMsg.NAME, meetingId)
val event = StopMeetingTranscodersSysCmdMsg(header, body)

BbbCommonEnvCoreMsg(envelope, event)
}
}
55 changes: 40 additions & 15 deletions akka-bbb-transcode/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ name := "bbb-transcode-akka"

organization := "org.bigbluebutton"

version := "0.0.1"
version := "0.0.2"

scalaVersion := "2.11.6"
scalaVersion := "2.12.2"

scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-Xlint",
"-Ywarn-dead-code",
"-language:_",
"-target:jvm-1.7",
"-target:jvm-1.8",
"-encoding", "UTF-8"
)

Expand All @@ -24,6 +24,8 @@ resolvers ++= Seq(
"blindside-repos" at "http://blindside.googlecode.com/svn/repository/"
)

resolvers += Resolver.sonatypeRepo("releases")

publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/dev/repo/maven-repo/releases" )) )

// We want to have our jar files in lib_managed dir.
Expand All @@ -35,24 +37,47 @@ testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "html", "console",

testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/scalatest-reports")

val akkaVersion = "2.5.1"
val scalaTestV = "2.2.6"

libraryDependencies ++= {
val akkaVersion = "2.3.11"
Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.0.3",
"org.pegdown" % "pegdown" % "1.4.0",
"junit" % "junit" % "4.11",
"com.etaty.rediscala" %% "rediscala" % "1.4.0",
"commons-codec" % "commons-codec" % "1.8",
"junit" % "junit" % "4.11",
"commons-codec" % "commons-codec" % "1.10",
"joda-time" % "joda-time" % "2.3",
"com.google.code.gson" % "gson" % "1.7.1",
"redis.clients" % "jedis" % "2.1.0",
"org.apache.commons" % "commons-lang3" % "3.2",
"org.bigbluebutton" % "bbb-common-message_2.12" % "0.0.19-SNAPSHOT"
"org.apache.commons" % "commons-lang3" % "3.2"
)}

libraryDependencies += "org.bigbluebutton" % "bbb-common-message_2.12" % "0.0.19-SNAPSHOT"

// https://mvnrepository.com/artifact/org.scala-lang/scala-library
libraryDependencies += "org.scala-lang" % "scala-library" % "2.12.2"
// https://mvnrepository.com/artifact/org.scala-lang/scala-compiler
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.12.2"

// https://mvnrepository.com/artifact/com.typesafe.akka/akka-actor_2.12
libraryDependencies += "com.typesafe.akka" % "akka-actor_2.12" % akkaVersion

// https://mvnrepository.com/artifact/com.typesafe.akka/akka-slf4j_2.12
libraryDependencies += "com.typesafe.akka" % "akka-slf4j_2.12" % akkaVersion

// https://mvnrepository.com/artifact/com.github.etaty/rediscala_2.12
libraryDependencies += "com.github.etaty" % "rediscala_2.12" % "1.8.0"

// For generating test reports
libraryDependencies += "org.pegdown" % "pegdown" % "1.6.0" % "test"
// https://mvnrepository.com/artifact/com.typesafe.akka/akka-testkit_2.12
libraryDependencies += "com.typesafe.akka" % "akka-testkit_2.12" % "2.5.1" % "test"

// https://mvnrepository.com/artifact/org.scalactic/scalactic_2.12
libraryDependencies += "org.scalactic" % "scalactic_2.12" % "3.0.3" % "test"

// https://mvnrepository.com/artifact/org.scalatest/scalatest_2.12
libraryDependencies += "org.scalatest" % "scalatest_2.12" % "3.0.3" % "test"

libraryDependencies += "org.mockito" % "mockito-core" % "2.7.22" % "test"

seq(Revolver.settings: _*)

scalariformSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.bigbluebutton.transcode.core.ffmpeg.FFmpegUtils;
import org.bigbluebutton.transcode.core.processmonitor.ProcessMonitor;
import org.bigbluebutton.transcode.core.processmonitor.ProcessMonitorObserver;
import org.bigbluebutton.common.messages.Constants;
import org.bigbluebutton.transcode.util.Constants;

import akka.actor.UntypedActor;
import akka.actor.ActorRef;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.bigbluebutton.transcode.util;

public class Constants {
public static final String WIDTH_RATIO = "width_ratio";
public static final String HEIGHT_RATIO = "height_ratio";
public static final String CALLERNAME = "callername";
public static final String VOICE_CONF = "voice_conf";
public static final String LOCAL_IP_ADDRESS = "local_ip_address";
public static final String LOCAL_VIDEO_PORT = "local_video_port";
public static final String REMOTE_VIDEO_PORT = "remote_video_port";
public static final String DESTINATION_IP_ADDRESS = "destination_ip_address";
public static final String SIP_HOST = "sip_host";
public static final String TRANSCODER_TYPE = "transcoder_type";
public static final String INPUT = "input";
public static final String OUTPUT = "output";
public static final String TRANSCODE_RTP_TO_RTMP = "transcode_rtp_to_rtmp";
public static final String TRANSCODE_RTMP_TO_RTP = "transcode_rtmp_to_rtp";
public static final String TRANSCODE_FILE_TO_RTP = "transcode_file_to_rtp";
public static final String TRANSCODE_FILE_TO_RTMP = "transcode_file_to_rtmp";
public static final String TRANSCODE_H264_TO_H263 = "transcode_h264_to_h263";
public static final String TRANSCODE_ROTATE_RIGHT = "transcode_rotate_right";
public static final String TRANSCODE_ROTATE_LEFT = "transcode_rotate_left";
public static final String TRANSCODE_ROTATE_UPSIDE_DOWN = "transcode_rotate_upside_down";
public static final String MODULE = "module";
public static final String PROBE_RTMP = "probe_rtmp";

public static final String HEADER = "header";
public static final String CORE = "core";
public static final String BODY = "body";
public static final String ENVELOPE = "envelope";
public static final String ROUTING = "routing";
public static final String NAME = "name";
public static final String SENDER = "sender";
public static final String PARAMS = "params";
public static final String TRANSCODER_ID = "transcoderId";
public static final String MEETING_ID = "meetingId";
public static final String VIDEO = "video";
}
18 changes: 9 additions & 9 deletions akka-bbb-transcode/src/main/scala/org/bigbluebutton/Boot.scala
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package org.bigbluebutton

import akka.actor.{ ActorSystem, Props }
import scala.concurrent.duration._
import redis.RedisClient
import scala.concurrent.{ Future, Await }
import scala.concurrent.ExecutionContext.Implicits.global
import akka.actor.ActorSystem

import org.bigbluebutton.endpoint.redis.{ RedisPublisher, AppsRedisSubscriberActor }
import org.bigbluebutton.transcode.pubsub.receivers.RedisMessageReceiver
import org.bigbluebutton.transcode.JsonMsgHdlrActor
import org.bigbluebutton.transcode.core.TranscodingInGW
import org.bigbluebutton.transcode.bus.InJsonMsgBus

object Boot extends App with SystemConfiguration {

implicit val system = ActorSystem("bigbluebutton-transcode-system")

val redisPublisher = new RedisPublisher(system)

var transcodingInGW = new TranscodingInGW(system, redisPublisher);
var inGW = new TranscodingInGW(system, redisPublisher)

val redisMsgReceiver = new RedisMessageReceiver(transcodingInGW);
val inJsonMsgBus = new InJsonMsgBus
val redisMessageHandlerActor = system.actorOf(JsonMsgHdlrActor.props(inGW))
inJsonMsgBus.subscribe(redisMessageHandlerActor, toAkkaTranscodeJsonChannel)

val redisSubscriberActor = system.actorOf(AppsRedisSubscriberActor.props(system, redisMsgReceiver), "redis-subscriber")
val redisSubscriberActor = system.actorOf(AppsRedisSubscriberActor.props(system, inJsonMsgBus), "redis-subscriber")
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ trait SystemConfiguration {
lazy val _videoconfLogoImagePath = Try(config.getString("videoconference.videoconf-logo-image-path")).getOrElse("")
lazy val _enableUserVideoSubtitle = Try(config.getString("videoconference.enable-user-video-subtitle").toBoolean).getOrElse(false)
lazy val _sipVideoResolution = Try(config.getString("videoconference.sip-video-resolution")).getOrElse("")

lazy val toAkkaTranscodeRedisChannel = Try(config.getString("redis.toAkkaTranscodeRedisChannel")).getOrElse("bigbluebutton:to-bbb-transcode:system")
lazy val fromAkkaTranscodeRedisChannel = Try(config.getString("redis.fromAkkaTranscodeRedisChannel")).getOrElse("bigbluebutton:from-bbb-transcode:system")
lazy val toAkkaTranscodeJsonChannel = Try(config.getString("eventBus.toAkkaTranscodeJsonChannel")).getOrElse("to-akka-transcode-json-channel")
lazy val fromAkkaTranscodeJsonChannel = Try(config.getString("eventBus.fromAkkaTranscodeJsonChannel")).getOrElse("from-akka-transcode-json-channel")
}
Loading

0 comments on commit d50f65f

Please sign in to comment.