adding some configurations in spring

This commit is contained in:
Markos Calderon 2013-06-19 19:59:25 -05:00
parent 7e06dc75e3
commit 288a3872fc
7 changed files with 37 additions and 4 deletions

View File

@ -9,14 +9,19 @@ import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
public class MeetingMessageHandler implements MessageHandler {
private static Logger log = Red5LoggerFactory.getLogger(MeetingMessageHandler.class, "bigbluebutton");
private static final String KEEP_ALIVE_REQUEST = "KEEP_ALIVE_REQUEST";
private IBigBlueButtonInGW bbbGW;
@Override
public void handleMessage(String pattern, String channel, String message) {
log.debug("Checking message: " + pattern + " " + channel + " " + message);
if (channel.equalsIgnoreCase(MessagingConstants.SYSTEM_CHANNEL)){
Gson gson = new Gson();
HashMap<String,String> map = gson.fromJson(message, new TypeToken<Map<String, String>>() {}.getType());
@ -27,6 +32,7 @@ public class MeetingMessageHandler implements MessageHandler {
bbbGW.endMeeting(meetingId);
}
if(messageId.equalsIgnoreCase(KEEP_ALIVE_REQUEST)){
log.debug("Sending keep alive request");
bbbGW.isAliveAudit();
}
}

View File

@ -49,6 +49,7 @@ public class ReceivedMessageHandler {
private void processMessage(ReceivedMessage msg) {
if (handler != null) {
log.debug("Let's process this message: " + msg.getMessage());
handler.notifyListeners(msg.getPattern(), msg.getChannel(), msg.getMessage());
} else {
log.warn("No listeners interested in messages from Redis!");

View File

@ -1,13 +1,18 @@
package org.bigbluebutton.core.api;
import java.util.Set;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
public class MessageOutGateway {
private static Logger log = Red5LoggerFactory.getLogger(MessageOutGateway.class, "bigbluebutton");
private Set<OutMessageListener2> listeners;
public void send(IOutMessage msg) {
log.debug("before listeners send. check message:" + msg);
for (OutMessageListener2 l : listeners) {
log.debug("listener " + l);
l.handleMessage(msg);
}
}

View File

@ -13,11 +13,17 @@ import org.bigbluebutton.core.api.DestroyMeeting
import org.bigbluebutton.core.api.KeepAliveMessage
import org.bigbluebutton.core.api.KeepAliveMessageReply
import org.red5.logging.Red5LoggerFactory
import org.slf4j.Logger
class BigBlueButtonActor(outGW: MessageOutGateway) extends Actor {
private var log = Red5LoggerFactory.getLogger(classOf[BigBlueButtonActor], "bigbluebutton")
private var meetings = new HashMap[String, Meeting]
def act() = {
loop {
react {
case createMeeting: CreateMeeting => handleCreateMeeting(createMeeting)
@ -30,6 +36,7 @@ class BigBlueButtonActor(outGW: MessageOutGateway) extends Actor {
}
private def handleMeetingMessage(msg: InMessage):Unit = {
log.debug("receiving:" + msg)
meetings.get(msg.meetingID) match {
case None => // do nothing
case Some(m) => m ! msg

View File

@ -4,9 +4,13 @@ import org.bigbluebutton.conference.service.messaging.redis.MessageSender
import org.bigbluebutton.core.api.OutMessageListener2
import org.bigbluebutton.core.api.IOutMessage
import org.bigbluebutton.core.api.KeepAliveMessageReply
import scala.collection.immutable.HashMap
import com.google.gson.Gson
class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListener2 {
private val KEEP_ALIVE_REPLY = "KEEP_ALIVE_REPLY"
def handleMessage(msg: IOutMessage) {
msg match {
case keepAliveMessageReply: KeepAliveMessageReply => handleKeepAliveMessageReply(keepAliveMessageReply)
@ -15,6 +19,9 @@ class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListe
}
private def handleKeepAliveMessageReply(msg: KeepAliveMessageReply):Unit = {
service.send("test:channel", "pong")
val gson = new Gson();
val map = Map("meetingId" -> "null", "messageId" -> KEEP_ALIVE_REPLY)
service.send("test:channel", gson.toJson(map))
}
}

View File

@ -32,12 +32,18 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="redisPool"> <ref bean="redisPool"/></property>
</bean>
<bean id="meetingEventRedisPublisher" class="org.bigbluebutton.core.meeting.MeetingEventRedisPublisher">
<constructor-arg ref="redisMessageSender" />
</bean>
<bean id="redisMessageReceiver" class="org.bigbluebutton.conference.service.messaging.redis.MessageReceiver" init-method="start" destroy-method="stop">
<property name="redisPool"> <ref bean="redisPool"/></property>
<property name="messageHandler"> <ref local="redisMessageHandler"/> </property>
</bean>
<bean id="redisMessageHandler" class="org.bigbluebutton.conference.service.messaging.redis.ReceivedMessageHandler" init-method="start" destroy-method="stop"/>
<bean id="redisMessageHandler" class="org.bigbluebutton.conference.service.messaging.redis.ReceivedMessageHandler" init-method="start" destroy-method="stop">
<property name="messageDistributor"><ref bean="redisMessageDistributor" /></property>
</bean>
<bean id="redisMessageDistributor" class="org.bigbluebutton.conference.service.messaging.redis.MessageDistributor">
<property name="messageHandler"> <ref local="redisMessageHandler"/> </property>

View File

@ -91,7 +91,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<ref bean="presentationRed5ClientSender" />
<ref bean="usersRed5ClientSender" />
<ref bean="presentationRedisRecorder" />
<ref bean="usersRedisRecorder" />
<ref bean="usersRedisRecorder" />
<ref bean="meetingEventRedisPublisher" />
</set>
</property>
</bean>