forked from bigbluebutton/bigbluebutton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
147 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 49 additions & 16 deletions
65
.../main/scala/org/bigbluebutton/app/screenshare/redis/ScreenshareRedisSubscriberActor.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,65 @@ | ||
package org.bigbluebutton.app.screenshare.redis | ||
|
||
import org.bigbluebutton.app.screenshare.SystemConfiguration | ||
import org.bigbluebutton.common2.bus.IncomingJsonMessageBus | ||
import org.bigbluebutton.common2.redis.RedisSubscriberProvider | ||
|
||
import org.bigbluebutton.common2.bus._ | ||
import org.bigbluebutton.common2.redis.{ RedisConfig, RedisSubscriberProvider } | ||
import akka.actor.ActorSystem | ||
import akka.actor.Props | ||
import io.lettuce.core.pubsub.RedisPubSubListener | ||
|
||
object ScreenshareRedisSubscriberActor extends SystemConfiguration { | ||
|
||
val channels = Seq(fromAkkaAppsRedisChannel) | ||
val patterns = Seq("bigbluebutton:to-bbb-apps:*", "bigbluebutton:from-voice-conf:*") | ||
object ScreenshareRedisSubscriberActor { | ||
|
||
def props(system: ActorSystem, jsonMsgBus: IncomingJsonMessageBus): Props = | ||
def props( | ||
system: ActorSystem, | ||
jsonMsgBus: IncomingJsonMessageBus, | ||
redisConfig: RedisConfig, | ||
channelsToSubscribe: Seq[String], | ||
patternsToSubscribe: Seq[String], | ||
forwardMsgToChannel: String): Props = | ||
Props( | ||
classOf[ScreenshareRedisSubscriberActor], | ||
system, jsonMsgBus, | ||
redisHost, redisPort, | ||
channels, patterns).withDispatcher("akka.redis-subscriber-worker-dispatcher") | ||
system, | ||
jsonMsgBus, | ||
redisConfig, | ||
channelsToSubscribe, | ||
patternsToSubscribe, | ||
forwardMsgToChannel).withDispatcher("akka.redis-subscriber-worker-dispatcher") | ||
} | ||
|
||
class ScreenshareRedisSubscriberActor( | ||
system: ActorSystem, | ||
jsonMsgBus: IncomingJsonMessageBus, | ||
redisHost: String, redisPort: Int, | ||
channels: Seq[String] = Nil, patterns: Seq[String] = Nil) | ||
extends RedisSubscriberProvider(system, "BbbScreenshareAkkaSub", channels, patterns, jsonMsgBus) with SystemConfiguration { | ||
redisConfig: RedisConfig, | ||
channelsToSubscribe: Seq[String], | ||
patternsToSubscribe: Seq[String], | ||
forwardMsgToChannel: String) | ||
extends RedisSubscriberProvider( | ||
system, | ||
"BbbScreenshareAkkaSub", | ||
channelsToSubscribe, | ||
patternsToSubscribe, | ||
jsonMsgBus, | ||
redisConfig) { | ||
|
||
addListener(toScreenshareAppsJsonChannel) | ||
/** | ||
* override def addListener(forwardMsgToChannel: String) { | ||
* connection.addListener(new RedisPubSubListener[String, String] { | ||
* def message(channel: String, message: String): Unit = { | ||
* println("**** RECEIVED MESSASGE FROm CHANNLE " + channel) | ||
* if (channelsToSubscribe.contains(channel)) { | ||
* val receivedJsonMessage = new ReceivedJsonMessage(channel, message) | ||
* jsonMsgBus.publish(IncomingJsonMessage(forwardMsgToChannel, receivedJsonMessage)) | ||
* } | ||
* } | ||
* def message(pattern: String, channel: String, message: String): Unit = { | ||
* log.debug(s"RECEIVED:\n ${message} \n") | ||
* } | ||
* def psubscribed(pattern: String, count: Long): Unit = { log.info("Subscribed to pattern {}", pattern) } | ||
* def punsubscribed(pattern: String, count: Long): Unit = { log.info("Unsubscribed from pattern {}", pattern) } | ||
* def subscribed(channel: String, count: Long): Unit = { log.info("Subscribed to pattern {}", channel) } | ||
* def unsubscribed(channel: String, count: Long): Unit = { log.info("Unsubscribed from channel {}", channel) } | ||
* }) | ||
* } | ||
*/ | ||
addListener(forwardMsgToChannel) | ||
subscribe() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.