refactor: remove html5InstanceId
This commit is contained in:
parent
4227ff4ab6
commit
58cdb75c45
@ -154,7 +154,7 @@ class BigBlueButtonActor(
|
||||
}
|
||||
|
||||
private def handleGetAllMeetingsReqMsg(msg: GetAllMeetingsReqMsg): Unit = {
|
||||
RunningMeetings.meetings(meetings).filter(_.props.systemProps.html5InstanceId == msg.body.html5InstanceId).foreach(m => {
|
||||
RunningMeetings.meetings(meetings).foreach(m => {
|
||||
m.actorRef ! msg
|
||||
})
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ trait SyncGetGroupChatsInfoMsgHdlr {
|
||||
def handleSyncGetGroupChatsInfo(state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
|
||||
|
||||
def buildSyncGetGroupChatsRespMsg(allChats: Vector[GroupChatInfo]): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetGroupChatsRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetGroupChatsRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val body = SyncGetGroupChatsRespMsgBody(allChats)
|
||||
@ -21,7 +21,7 @@ trait SyncGetGroupChatsInfoMsgHdlr {
|
||||
}
|
||||
|
||||
def buildSyncGetGroupChatMsgsRespMsg(msgs: Vector[GroupChatMsgToUser], chatId: String): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetGroupChatMsgsRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetGroupChatMsgsRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val body = SyncGetGroupChatMsgsRespMsgBody(chatId, msgs)
|
||||
|
@ -9,7 +9,7 @@ trait SyncGetMeetingInfoRespMsgHdlr {
|
||||
val outGW: OutMsgRouter
|
||||
|
||||
def handleSyncGetMeetingInfoRespMsg(props: DefaultProps): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(props.meetingProp.intId, props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetMeetingInfoRespMsg.NAME, routing)
|
||||
val header = BbbCoreBaseHeader(SyncGetMeetingInfoRespMsg.NAME)
|
||||
|
||||
|
@ -16,7 +16,7 @@ object PadslHdlrHelpers {
|
||||
outGW.send(msgEvent)
|
||||
}
|
||||
|
||||
def broadcastPadCreateCmdMsg(outGW: OutMsgRouter, meetingId: String,groupId: String, name: String): Unit = {
|
||||
def broadcastPadCreateCmdMsg(outGW: OutMsgRouter, meetingId: String, groupId: String, name: String): Unit = {
|
||||
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
|
||||
val envelope = BbbCoreEnvelope(PadCreateCmdMsg.NAME, routing)
|
||||
val header = BbbCoreHeaderWithMeetingId(PadCreateCmdMsg.NAME, meetingId)
|
||||
|
@ -12,7 +12,7 @@ trait SyncGetPresentationPodsMsgHdlr {
|
||||
def handleSyncGetPresentationPods(state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
|
||||
|
||||
def buildSyncGetPresentationPodsRespMsg(pods: Vector[PresentationPodVO]): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetPresentationPodsRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetPresentationPodsRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
|
||||
|
@ -9,9 +9,10 @@ trait SyncGetScreenshareInfoRespMsgHdlr {
|
||||
this: ScreenshareApp2x =>
|
||||
|
||||
def handleSyncGetScreenshareInfoRespMsg(liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(
|
||||
val routing = Routing.addMsgToClientRouting(
|
||||
MessageTypes.BROADCAST_TO_MEETING,
|
||||
liveMeeting.props.meetingProp.intId,
|
||||
liveMeeting.props.systemProps.html5InstanceId.toString
|
||||
"nodeJSapp"
|
||||
)
|
||||
val envelope = BbbCoreEnvelope(SyncGetScreenshareInfoRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(
|
||||
|
@ -11,7 +11,7 @@ trait SyncGetUsersMeetingRespMsgHdlr {
|
||||
val outGW: OutMsgRouter
|
||||
|
||||
def handleSyncGetUsersMeetingRespMsg(): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetUsersMeetingRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetUsersMeetingRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
|
||||
|
@ -17,7 +17,7 @@ trait SyncGetVoiceUsersMsgHdlr {
|
||||
callerNum = u.callerNum, color = u.color, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly)
|
||||
}
|
||||
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetVoiceUsersRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetVoiceUsersRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val body = SyncGetVoiceUsersRespMsgBody(voiceUsers)
|
||||
|
@ -13,9 +13,10 @@ trait SyncGetWebcamInfoRespMsgHdlr {
|
||||
this: WebcamApp2x =>
|
||||
|
||||
def handleSyncGetWebcamInfoRespMsg(liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(
|
||||
val routing = Routing.addMsgToClientRouting(
|
||||
MessageTypes.BROADCAST_TO_MEETING,
|
||||
liveMeeting.props.meetingProp.intId,
|
||||
liveMeeting.props.systemProps.html5InstanceId.toString
|
||||
"nodeJSapp"
|
||||
)
|
||||
val envelope = BbbCoreEnvelope(SyncGetWebcamInfoRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(
|
||||
|
@ -11,7 +11,7 @@ trait ClearWhiteboardPubMsgHdlr extends RightsManagementTrait {
|
||||
def handle(msg: ClearWhiteboardPubMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||
|
||||
def broadcastEvent(msg: ClearWhiteboardPubMsg, fullClear: Boolean): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
val envelope = BbbCoreEnvelope(ClearWhiteboardEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(ClearWhiteboardEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
||||
|
@ -11,7 +11,7 @@ trait DeleteWhiteboardAnnotationsPubMsgHdlr extends RightsManagementTrait {
|
||||
def handle(msg: DeleteWhiteboardAnnotationsPubMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||
|
||||
def broadcastEvent(msg: DeleteWhiteboardAnnotationsPubMsg, removedAnnotationsIds: Array[String]): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
val envelope = BbbCoreEnvelope(DeleteWhiteboardAnnotationsEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(DeleteWhiteboardAnnotationsEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
||||
|
@ -10,7 +10,7 @@ trait GetWhiteboardAnnotationsReqMsgHdlr {
|
||||
def handle(msg: GetWhiteboardAnnotationsReqMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||
|
||||
def broadcastEvent(msg: GetWhiteboardAnnotationsReqMsg, history: Array[AnnotationVO], multiUser: Array[String]): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
||||
val envelope = BbbCoreEnvelope(GetWhiteboardAnnotationsRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(GetWhiteboardAnnotationsRespMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
@ -11,7 +11,7 @@ trait ModifyWhiteboardAccessPubMsgHdlr extends RightsManagementTrait {
|
||||
def handle(msg: ModifyWhiteboardAccessPubMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||
|
||||
def broadcastEvent(msg: ModifyWhiteboardAccessPubMsg): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
val envelope = BbbCoreEnvelope(ModifyWhiteboardAccessEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(ModifyWhiteboardAccessEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
||||
|
@ -12,7 +12,7 @@ trait SendCursorPositionPubMsgHdlr extends RightsManagementTrait {
|
||||
def handle(msg: SendCursorPositionPubMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||
|
||||
def broadcastEvent(msg: SendCursorPositionPubMsg): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
val envelope = BbbCoreEnvelope(SendCursorPositionEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SendCursorPositionEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
||||
|
@ -10,8 +10,8 @@ trait SendWhiteboardAnnotationsPubMsgHdlr extends RightsManagementTrait {
|
||||
|
||||
def handle(msg: SendWhiteboardAnnotationsPubMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
|
||||
|
||||
def broadcastEvent(msg: SendWhiteboardAnnotationsPubMsg, whiteboardId: String, annotations: Array[AnnotationVO], html5InstanceId: String): Unit = {
|
||||
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, html5InstanceId)
|
||||
def broadcastEvent(msg: SendWhiteboardAnnotationsPubMsg, whiteboardId: String, annotations: Array[AnnotationVO]): Unit = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
val envelope = BbbCoreEnvelope(SendWhiteboardAnnotationsEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SendWhiteboardAnnotationsEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
||||
@ -58,7 +58,7 @@ trait SendWhiteboardAnnotationsPubMsgHdlr extends RightsManagementTrait {
|
||||
// }
|
||||
// println("============= Printed Sanitized annotations ============")
|
||||
val annotations = sendWhiteboardAnnotations(msg.body.whiteboardId, msg.header.userId, msg.body.annotations, liveMeeting, isUserAmongPresenters, isUserModerator)
|
||||
broadcastEvent(msg, msg.body.whiteboardId, annotations, msg.body.html5InstanceId)
|
||||
broadcastEvent(msg, msg.body.whiteboardId, annotations)
|
||||
} else {
|
||||
//val meetingId = liveMeeting.props.meetingProp.intId
|
||||
//val reason = "No permission to send a whiteboard annotation."
|
||||
|
@ -18,27 +18,18 @@ class FromAkkaAppsMsgSenderActor(msgSender: MessageSender)
|
||||
case _ => log.warning("Cannot handle message ")
|
||||
}
|
||||
|
||||
def sendToHTML5InstanceIdChannel(msg: BbbCommonEnvCoreMsg, json: String): Unit = {
|
||||
msg.envelope.routing.get("html5InstanceId") match {
|
||||
case Some(id) => {
|
||||
msgSender.send(toHTML5RedisChannel.concat(id), json)
|
||||
}
|
||||
case _ => log.error("No html5InstanceId for " + msg.envelope.name)
|
||||
}
|
||||
}
|
||||
|
||||
def handleBbbCommonEnvCoreMsg(msg: BbbCommonEnvCoreMsg): Unit = {
|
||||
val json = JsonUtil.toJson(msg)
|
||||
|
||||
msg.envelope.name match {
|
||||
|
||||
// HTML5 sync messages
|
||||
case SyncGetPresentationPodsRespMsg.NAME => sendToHTML5InstanceIdChannel(msg, json)
|
||||
case SyncGetMeetingInfoRespMsg.NAME => sendToHTML5InstanceIdChannel(msg, json)
|
||||
case SyncGetUsersMeetingRespMsg.NAME => sendToHTML5InstanceIdChannel(msg, json)
|
||||
case SyncGetGroupChatsRespMsg.NAME => sendToHTML5InstanceIdChannel(msg, json)
|
||||
case SyncGetGroupChatMsgsRespMsg.NAME => sendToHTML5InstanceIdChannel(msg, json)
|
||||
case SyncGetVoiceUsersRespMsg.NAME => sendToHTML5InstanceIdChannel(msg, json)
|
||||
case SyncGetPresentationPodsRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json)
|
||||
case SyncGetMeetingInfoRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json)
|
||||
case SyncGetUsersMeetingRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json)
|
||||
case SyncGetGroupChatsRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json)
|
||||
case SyncGetGroupChatMsgsRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json)
|
||||
case SyncGetVoiceUsersRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json)
|
||||
|
||||
// Sent to FreeSWITCH
|
||||
case EjectAllFromVoiceConfMsg.NAME =>
|
||||
|
@ -68,7 +68,6 @@ case class LockSettingsProps(
|
||||
)
|
||||
|
||||
case class SystemProps(
|
||||
html5InstanceId: Int,
|
||||
loginUrl: String,
|
||||
logoutUrl: String,
|
||||
customLogoURL: String,
|
||||
|
@ -4,7 +4,6 @@ object Routing {
|
||||
val MSG_TYPE = "msgType"
|
||||
val MEETING_ID = "meetingId"
|
||||
val USER_ID = "userId"
|
||||
val HTML5_INSTANCE_ID = "html5InstanceId"
|
||||
|
||||
def addMsgToClientRouting(msgType: String, meetingId: String, userId: String): collection.immutable.Map[String, String] = {
|
||||
Map(MSG_TYPE -> msgType, MEETING_ID -> meetingId, USER_ID -> userId)
|
||||
@ -13,10 +12,6 @@ object Routing {
|
||||
def addMsgFromClientRouting(meetingId: String, userId: String): collection.immutable.Map[String, String] = {
|
||||
Map(MEETING_ID -> meetingId, USER_ID -> userId)
|
||||
}
|
||||
|
||||
def addMsgToHtml5InstanceIdRouting(meetingId: String, html5InstanceId: String): collection.immutable.Map[String, String] = {
|
||||
Map(MEETING_ID -> meetingId, HTML5_INSTANCE_ID -> html5InstanceId)
|
||||
}
|
||||
}
|
||||
|
||||
class Routing {
|
||||
|
@ -35,7 +35,7 @@ case class GetAllMeetingsReqMsg(
|
||||
header: BbbCoreBaseHeader,
|
||||
body: GetAllMeetingsReqMsgBody
|
||||
) extends BbbCoreMsg
|
||||
case class GetAllMeetingsReqMsgBody(requesterId: String, html5InstanceId: Int)
|
||||
case class GetAllMeetingsReqMsgBody(requesterId: String)
|
||||
|
||||
object GetRunningMeetingsReqMsg { val NAME = "GetRunningMeetingsReqMsg" }
|
||||
case class GetRunningMeetingsReqMsg(
|
||||
|
@ -54,7 +54,7 @@ case class SendCursorPositionPubMsgBody(whiteboardId: String, xPercent: Double,
|
||||
|
||||
object SendWhiteboardAnnotationsPubMsg { val NAME = "SendWhiteboardAnnotationsPubMsg" }
|
||||
case class SendWhiteboardAnnotationsPubMsg(header: BbbClientMsgHeader, body: SendWhiteboardAnnotationsPubMsgBody) extends StandardMsg
|
||||
case class SendWhiteboardAnnotationsPubMsgBody(whiteboardId: String, annotations: Array[AnnotationVO], html5InstanceId: String)
|
||||
case class SendWhiteboardAnnotationsPubMsgBody(whiteboardId: String, annotations: Array[AnnotationVO])
|
||||
|
||||
object DeleteWhiteboardAnnotationsPubMsg { val NAME = "DeleteWhiteboardAnnotationsPubMsg" }
|
||||
case class DeleteWhiteboardAnnotationsPubMsg(header: BbbClientMsgHeader, body: DeleteWhiteboardAnnotationsPubMsgBody) extends StandardMsg
|
||||
|
@ -68,7 +68,6 @@ public class ApiParams {
|
||||
public static final String MEETING_EXPIRE_IF_NO_USER_JOINED_IN_MINUTES = "meetingExpireIfNoUserJoinedInMinutes";
|
||||
public static final String MEETING_EXPIRE_WHEN_LAST_USER_LEFT_IN_MINUTES = "meetingExpireWhenLastUserLeftInMinutes";
|
||||
public static final String WELCOME = "welcome";
|
||||
public static final String HTML5_INSTANCE_ID = "html5InstanceId";
|
||||
public static final String ROLE = "role";
|
||||
public static final String GROUPS = "groups";
|
||||
public static final String DISABLED_FEATURES = "disabledFeatures";
|
||||
|
@ -1,97 +0,0 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
* <p>
|
||||
* Copyright (c) 2020 BigBlueButton Inc. and by respective authors (see below).
|
||||
* <p>
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
* <p>
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
* <p>
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.bigbluebutton.api;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bigbluebutton.api.util.HTML5ProcessLine;
|
||||
|
||||
|
||||
public class HTML5LoadBalancingService {
|
||||
private static Logger log = LoggerFactory.getLogger(HTML5LoadBalancingService.class);
|
||||
private ArrayList<HTML5ProcessLine> list = new ArrayList<HTML5ProcessLine>();
|
||||
private final int MAX_NUMBER_OF_HTML5_INSTANCES = 20;
|
||||
private int lastSelectedInstanceId = 0;
|
||||
|
||||
public void init() {
|
||||
log.info("HTML5LoadBalancingService initialised");
|
||||
}
|
||||
|
||||
// Find nodejs processes associated with processing meeting events
|
||||
// $ ps -u meteor -o pcpu,cmd= | grep NODEJS_BACKEND_INSTANCE_ID
|
||||
// 1.1 /usr/lib/bbb-html5/node/bin/node --max-old-space-size=2048 --max_semi_space_size=128 main.js NODEJS_BACKEND_INSTANCE_ID=1
|
||||
// 1.0 /usr/lib/bbb-html5/node/bin/node --max-old-space-size=2048 --max_semi_space_size=128 main.js NODEJS_BACKEND_INSTANCE_ID=2
|
||||
public void scanHTML5processes() {
|
||||
try {
|
||||
this.list = new ArrayList<HTML5ProcessLine>();
|
||||
Process p1 = Runtime.getRuntime().exec(new String[]{"ps", "-u", "meteor", "-o", "pcpu,cmd="});
|
||||
InputStream input1 = p1.getInputStream();
|
||||
Process p2 = Runtime.getRuntime().exec(new String[]{"grep", HTML5ProcessLine.BBB_HTML5_PROCESS_IDENTIFIER});
|
||||
OutputStream output = p2.getOutputStream();
|
||||
IOUtils.copy(input1, output);
|
||||
output.close(); // signals grep to finish
|
||||
List<String> result = IOUtils.readLines(p2.getInputStream());
|
||||
for (String entry : result) {
|
||||
HTML5ProcessLine line = new HTML5ProcessLine(entry);
|
||||
list.add(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean listItemWithIdExists(int id) {
|
||||
for (HTML5ProcessLine line : this.list) {
|
||||
if (line.instanceId == id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int findSuitableHTML5ProcessByRoundRobin() {
|
||||
this.scanHTML5processes();
|
||||
if (list.isEmpty()) {
|
||||
log.warn("Did not find any instances of html5 process running");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = lastSelectedInstanceId + 1; i <= MAX_NUMBER_OF_HTML5_INSTANCES + lastSelectedInstanceId; i++) {
|
||||
int k = i % (MAX_NUMBER_OF_HTML5_INSTANCES + 1);
|
||||
if (this.listItemWithIdExists(k)) {
|
||||
this.lastSelectedInstanceId = k;
|
||||
return k;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
@ -452,7 +452,7 @@ public class MeetingService implements MessageListener {
|
||||
m.getUserInactivityInspectTimerInMinutes(), m.getUserInactivityThresholdInMinutes(),
|
||||
m.getUserActivitySignResponseDelayInMinutes(), m.getEndWhenNoModerator(), m.getEndWhenNoModeratorDelayInMinutes(),
|
||||
m.getMuteOnStart(), m.getAllowModsToUnmuteUsers(), m.getAllowModsToEjectCameras(), m.getMeetingKeepEvents(),
|
||||
m.breakoutRoomsParams, m.lockSettingsParams, m.getHtml5InstanceId(), m.getLoginUrl(), m.getLogoutUrl(), m.getCustomLogoURL(),
|
||||
m.breakoutRoomsParams, m.lockSettingsParams, m.getLoginUrl(), m.getLogoutUrl(), m.getCustomLogoURL(),
|
||||
m.getBannerText(), m.getBannerColor(), m.getGroups(), m.getDisabledFeatures(), m.getNotifyRecordingIsOn(),
|
||||
m.getPresentationUploadExternalDescription(), m.getPresentationUploadExternalUrl(),
|
||||
m.getOverrideClientSettings());
|
||||
|
@ -134,7 +134,6 @@ public class ParamsProcessorUtil {
|
||||
private Integer maxUserConcurrentAccesses = 0;
|
||||
private Boolean defaultEndWhenNoModerator = false;
|
||||
private Integer defaultEndWhenNoModeratorDelayInMinutes = 1;
|
||||
private Integer defaultHtml5InstanceId = 1;
|
||||
|
||||
private String bbbVersion = "";
|
||||
private Boolean allowRevealOfBBBVersion = false;
|
||||
@ -731,8 +730,6 @@ public class ParamsProcessorUtil {
|
||||
|
||||
String avatarURL = useDefaultAvatar ? defaultAvatarURL : "";
|
||||
|
||||
int html5InstanceId = processHtml5InstanceId(params.get(ApiParams.HTML5_INSTANCE_ID));
|
||||
|
||||
if(defaultAllowDuplicateExtUserid == false) {
|
||||
log.warn("[DEPRECATION] use `maxUserConcurrentAccesses=1` instead of `allowDuplicateExtUserid=false`");
|
||||
maxUserConcurrentAccesses = 1;
|
||||
@ -768,7 +765,6 @@ public class ParamsProcessorUtil {
|
||||
.withBreakoutRoomsParams(breakoutParams)
|
||||
.withLockSettingsParams(lockSettingsParams)
|
||||
.withMaxUserConcurrentAccesses(maxUserConcurrentAccesses)
|
||||
.withHTML5InstanceId(html5InstanceId)
|
||||
.withLearningDashboardCleanupDelayInMinutes(learningDashboardCleanupMins)
|
||||
.withLearningDashboardAccessToken(learningDashboardAccessToken)
|
||||
.withGroups(groups)
|
||||
@ -795,7 +791,6 @@ public class ParamsProcessorUtil {
|
||||
meeting.setUserInactivityInspectTimerInMinutes(userInactivityInspectTimerInMinutes);
|
||||
meeting.setUserActivitySignResponseDelayInMinutes(userActivitySignResponseDelayInMinutes);
|
||||
meeting.setUserInactivityThresholdInMinutes(userInactivityThresholdInMinutes);
|
||||
// meeting.setHtml5InstanceId(html5InstanceId);
|
||||
meeting.setEndWhenNoModerator(endWhenNoModerator);
|
||||
meeting.setEndWhenNoModeratorDelayInMinutes(endWhenNoModeratorDelayInMinutes);
|
||||
|
||||
@ -978,17 +973,6 @@ public class ParamsProcessorUtil {
|
||||
return rec;
|
||||
}
|
||||
|
||||
public int processHtml5InstanceId(String instanceId) {
|
||||
int html5InstanceId = 1;
|
||||
try {
|
||||
html5InstanceId = Integer.parseInt(instanceId);
|
||||
} catch(Exception ex) {
|
||||
html5InstanceId = defaultHtml5InstanceId;
|
||||
}
|
||||
|
||||
return html5InstanceId;
|
||||
}
|
||||
|
||||
public int processMaxUser(String maxUsers) {
|
||||
int mUsers = -1;
|
||||
|
||||
|
@ -117,8 +117,6 @@ public class Meeting {
|
||||
|
||||
private String meetingEndedCallbackURL = "";
|
||||
|
||||
private Integer html5InstanceId;
|
||||
|
||||
private String overrideClientSettings = "";
|
||||
|
||||
public Meeting(Meeting.Builder builder) {
|
||||
@ -174,7 +172,6 @@ public class Meeting {
|
||||
maxUserConcurrentAccesses = builder.maxUserConcurrentAccesses;
|
||||
endWhenNoModerator = builder.endWhenNoModerator;
|
||||
endWhenNoModeratorDelayInMinutes = builder.endWhenNoModeratorDelayInMinutes;
|
||||
html5InstanceId = builder.html5InstanceId;
|
||||
groups = builder.groups;
|
||||
guestUsersWithPositionInWaitingLine = new HashMap<>();
|
||||
userCustomData = new HashMap<>();
|
||||
@ -286,10 +283,6 @@ public class Meeting {
|
||||
return GuestPolicy.DENY;
|
||||
}
|
||||
|
||||
public int getHtml5InstanceId() { return html5InstanceId; }
|
||||
|
||||
public void setHtml5InstanceId(int instanceId) { html5InstanceId = instanceId; }
|
||||
|
||||
public ArrayList<Group> getGroups() { return groups; }
|
||||
|
||||
public void setGroups(ArrayList<Group> groups) { this.groups = groups; }
|
||||
@ -925,7 +918,6 @@ public class Meeting {
|
||||
private Integer maxUserConcurrentAccesses;
|
||||
private Boolean endWhenNoModerator;
|
||||
private Integer endWhenNoModeratorDelayInMinutes;
|
||||
private int html5InstanceId;
|
||||
private ArrayList<Group> groups;
|
||||
|
||||
public Builder(String externalId, String internalId, long createTime) {
|
||||
@ -1139,11 +1131,6 @@ public class Meeting {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withHTML5InstanceId(int instanceId) {
|
||||
html5InstanceId = instanceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withGroups(ArrayList<Group> groups) {
|
||||
this.groups = groups;
|
||||
return this;
|
||||
|
@ -1,48 +0,0 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
* <p>
|
||||
* Copyright (c) 2020 BigBlueButton Inc. and by respective authors (see below).
|
||||
* <p>
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
* <p>
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
* <p>
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.bigbluebutton.api.util;
|
||||
|
||||
public class HTML5ProcessLine {
|
||||
|
||||
public int instanceId;
|
||||
public double percentageCPU;
|
||||
|
||||
public static final String BBB_HTML5_PROCESS_IDENTIFIER = "NODEJS_BACKEND_INSTANCE_ID";
|
||||
|
||||
public HTML5ProcessLine(String input) {
|
||||
// $ ps -u meteor -o pcpu,cmd= | grep NODEJS_BACKEND_INSTANCE_ID
|
||||
// 1.1 /usr/lib/bbb-html5/node/bin/node --max-old-space-size=2048 --max_semi_space_size=128 main.js NODEJS_BACKEND_INSTANCE_ID=1
|
||||
// 1.0 /usr/lib/bbb-html5/node/bin/node --max-old-space-size=2048 --max_semi_space_size=128 main.js NODEJS_BACKEND_INSTANCE_ID=2
|
||||
|
||||
String[] a = input.trim().split(" ");
|
||||
this.percentageCPU = Double.parseDouble(a[0]);
|
||||
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if (a[i].toString().indexOf(BBB_HTML5_PROCESS_IDENTIFIER) > -1) {
|
||||
this.instanceId = Integer.parseInt(a[i].replace(BBB_HTML5_PROCESS_IDENTIFIER + "=", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "instanceId:" + this.instanceId + " CPU:" + this.percentageCPU;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -41,7 +41,6 @@ public interface IBbbWebApiGWApp {
|
||||
Boolean keepEvents,
|
||||
BreakoutRoomsParams breakoutParams,
|
||||
LockSettingsParams lockSettingsParams,
|
||||
Integer html5InstanceId,
|
||||
String loginUrl,
|
||||
String logoutUrl,
|
||||
String customLogoURL,
|
||||
|
@ -148,7 +148,6 @@ class BbbWebApiGWApp(
|
||||
keepEvents: java.lang.Boolean,
|
||||
breakoutParams: BreakoutRoomsParams,
|
||||
lockSettingsParams: LockSettingsParams,
|
||||
html5InstanceId: java.lang.Integer,
|
||||
loginUrl: String,
|
||||
logoutUrl: String,
|
||||
customLogoURL: String,
|
||||
@ -235,7 +234,6 @@ class BbbWebApiGWApp(
|
||||
)
|
||||
|
||||
val systemProps = SystemProps(
|
||||
html5InstanceId,
|
||||
loginUrl match {
|
||||
case url: String => url
|
||||
case _ => ""
|
||||
|
@ -22,7 +22,6 @@ export default function buildRedisMessage(sessionVariables: Record<string, unkno
|
||||
const body = {
|
||||
whiteboardId: input.pageId,
|
||||
annotations: input.annotations,
|
||||
html5InstanceId: '', //TODO remove this prop from bbb-common-msg
|
||||
};
|
||||
|
||||
return { eventName, routing, header, body };
|
||||
|
@ -9,7 +9,6 @@ export default function MeetingInfo() {
|
||||
disabledFeatures
|
||||
durationInSeconds
|
||||
extId
|
||||
html5InstanceId
|
||||
isBreakout
|
||||
maxPinnedCameras
|
||||
meetingCameraCap
|
||||
|
@ -19,7 +19,6 @@ create table "meeting" (
|
||||
"presentationUploadExternalDescription" text,
|
||||
"presentationUploadExternalUrl" varchar(500),
|
||||
"learningDashboardAccessToken" varchar(100),
|
||||
"html5InstanceId" varchar(100),
|
||||
"loginUrl" varchar(500),
|
||||
"logoutUrl" varchar(500),
|
||||
"customLogoUrl" varchar(500),
|
||||
|
@ -171,7 +171,6 @@ select_permissions:
|
||||
- endedByUserName
|
||||
- endedReasonCode
|
||||
- extId
|
||||
- html5InstanceId
|
||||
- isBreakout
|
||||
- loginUrl
|
||||
- logoutUrl
|
||||
|
@ -111,7 +111,6 @@ export interface Meeting {
|
||||
disabledFeatures: Array<string>;
|
||||
durationInSeconds: number;
|
||||
extId: string;
|
||||
html5InstanceId: string | null;
|
||||
isBreakout: boolean;
|
||||
learningDashboardAccessToken: string;
|
||||
maxPinnedCameras: number;
|
||||
|
@ -97,7 +97,6 @@ const MEETING_SUBSCRIPTION = gql`
|
||||
record
|
||||
sequence
|
||||
}
|
||||
html5InstanceId
|
||||
voiceSettings {
|
||||
dialNumber
|
||||
muteOnStart
|
||||
|
@ -118,8 +118,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="learningDashboardFilesDir" value="${learningDashboardFilesDir}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="html5LoadBalancingService" class="org.bigbluebutton.api.HTML5LoadBalancingService" init-method="init" />
|
||||
|
||||
<bean id="validationService" class="org.bigbluebutton.api.service.ValidationService">
|
||||
<property name="securitySalt" value="${securitySalt}"/>
|
||||
<property name="supportedChecksumAlgorithms" value="${supportedChecksumAlgorithms}"/>
|
||||
|
@ -62,7 +62,6 @@ class ApiController {
|
||||
ParamsProcessorUtil paramsProcessorUtil
|
||||
PresentationUrlDownloadService presDownloadService
|
||||
StunTurnService stunTurnService
|
||||
HTML5LoadBalancingService html5LoadBalancingService
|
||||
ResponseBuilder responseBuilder = initResponseBuilder()
|
||||
ValidationService validationService
|
||||
|
||||
@ -184,8 +183,6 @@ class ApiController {
|
||||
// Still no unique voiceBridge found? Let createMeeting handle it.
|
||||
}
|
||||
|
||||
params.html5InstanceId = html5LoadBalancingService.findSuitableHTML5ProcessByRoundRobin().toString()
|
||||
|
||||
Meeting newMeeting = paramsProcessorUtil.processCreateParams(params)
|
||||
|
||||
String requestBody = request.inputStream == null ? null : request.inputStream.text
|
||||
|
Loading…
Reference in New Issue
Block a user