Send out message to store annotation and export job in Redis

This commit is contained in:
Daniel Petri Rocha 2022-01-25 18:15:11 +01:00
parent 6c13edc32c
commit 41a7ff87ea
8 changed files with 83 additions and 47 deletions

View File

@ -31,31 +31,6 @@ case class PresentationPage(
heightRatio: Double = 100D
)
case class PresentationPageForExport(
page: Int,
xOffset: Double,
yOffset: Double,
widthRatio: Double,
heightRatio: Double,
annotations: Array[AnnotationVO],
)
case class StoredAnnotations(
presId: String,
pages: Array[PresentationPageForExport],
)
case class ExportJob(
jobId: String,
jobType: String,
presId: String,
presLocation: String,
allPages: Boolean,
pages: Array[PresentationPageForExport],
parentMeetingId: String,
presUploadToken: String,
)
object PresentationInPod {
def addPage(pres: PresentationInPod, page: PresentationPage): PresentationInPod = {
val newPages = pres.pages + (page.id -> page)

View File

@ -26,7 +26,7 @@ class ReceivedJsonMsgHandlerActor(
def receive = {
case msg: ReceivedJsonMessage =>
// log.debug("handling {} - {}", msg.channel, msg.data)
// log.debug("handling {} - {}", msg.channel, msg.data)
handleReceivedJsonMessage(msg)
case _ => // do nothing
}

View File

@ -719,8 +719,27 @@ class MeetingActor(
}
def buildStoreAnnotationsInRedisSysMsg(annotations: StoredAnnotations): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
val envelope = BbbCoreEnvelope(StoreAnnotationsInRedisSysMsg.NAME, routing)
val body = StoreAnnotationsInRedisSysMsgBody(annotations)
val header = BbbCoreBaseHeader(StoreAnnotationsInRedisSysMsg.NAME)
val event = StoreAnnotationsInRedisSysMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
def buildStoreExportJobInRedisSysMsg(exportJob: ExportJob): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
val envelope = BbbCoreEnvelope(StoreExportJobInRedisSysMsg.NAME, routing)
val body = StoreExportJobInRedisSysMsgBody(exportJob)
val header = BbbCoreBaseHeader(StoreExportJobInRedisSysMsg.NAME)
val event = StoreExportJobInRedisSysMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
def handleMakePresentationWithAnnotationDownloadReqMsg(m: MakePresentationWithAnnotationDownloadReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting): Unit = {
println("*** Current Whiteboard State ***")
val presId: String = m.body.presId // Whiteboard ID
val allPages: Boolean = m.body.allPages // Whether or not all pages of the presentation should be exported
@ -741,8 +760,6 @@ class MeetingActor(
// whiteboardId = s"${presId}/${pageNumber.toString}" // TODO: use this
whiteboardId = s"${getMeetingInfoPresentationDetails().id}/${pageNumber.toString}"
println(currentPres.pages(whiteboardId))
val presentationPage: PresentationPage = currentPres.pages(whiteboardId)
val xOffset: Double = presentationPage.xOffset
val yOffset: Double = presentationPage.yOffset
@ -750,36 +767,30 @@ class MeetingActor(
val heightRatio: Double = presentationPage.heightRatio
val whiteboardHistory: Array[AnnotationVO] = liveMeeting.wbModel.getHistory(whiteboardId)
println("*****")
println("")
storeAnnotationPages(index) = new PresentationPageForExport(index + 1, xOffset, yOffset, widthRatio, heightRatio, whiteboardHistory)
index += 1
}
// 1) Export Annotations to Redis
// 1) Send Annotations to Redis
var annotations = new StoredAnnotations(presId, storeAnnotationPages)
println(annotations)
outGW.send(buildStoreAnnotationsInRedisSysMsg(annotations))
// val event = MsgBuilder.buildStoreAnnotationsInRedisMsg(
// props.meetingProp.intId,
// props.voiceProp.voiceConf
// )
// outGW.send(event)
// 2) Insert Export Job to Redis
// 2) Insert Export Job in Redis
val jobId = RandomStringGenerator.randomAlphanumericString(16)
val jobType = "PresentationWithAnnotationDownloadJob"
val presLocation = s"/var/bigbluebutton/${presId}"
val exportJob = new ExportJob(jobId, jobType, presLocation, allPages, storeAnnotationPages, "", "")
val exportJob = new ExportJob(jobId, jobType, presId, presLocation, allPages, storeAnnotationPages, "", "")
var job = buildStoreExportJobInRedisSysMsg(exportJob)
outGW.send(job)
}
def handleExportPresentationWithAnnotationReqMsg(liveMeeting: LiveMeeting): Unit = {
log.warning("***** Hello World 2! ")
val jobType = "PresentationWithAnnotationExportJob"
// 1) Insert Export Job to Redis
// 2) Export Annotations to Redis
}
def handleDeskShareGetDeskShareInfoRequest(msg: DeskShareGetDeskShareInfoRequest): Unit = {

View File

@ -114,6 +114,10 @@ class AnalyticsActor(val includeChat: Boolean) extends Actor with ActorLogging {
case m: SetPresentationDownloadableEvtMsg => logMessage(msg)
//case m: PresentationPageConvertedSysMsg => logMessage(msg)
//case m: PresentationPageConvertedEventMsg => logMessage(msg)
case m: StoreAnnotationsInRedisSysMsg => logMessage(msg)
case m: StoreExportJobInRedisSysMsg => logMessage(msg)
case m: MakePresentationWithAnnotationDownloadReqMsg => logMessage(msg)
case m: ExportPresentationWithAnnotationReqMsg => logMessage(msg)
case m: PresentationPageConversionStartedSysMsg => logMessage(msg)
case m: PresentationConversionEndedSysMsg => logMessage(msg)
case m: PresentationConversionRequestReceivedSysMsg => logMessage(msg)

View File

@ -73,6 +73,8 @@ class RedisRecorderActor(
case m: CreateNewPresentationPodEvtMsg => handleCreateNewPresentationPodEvtMsg(m)
case m: RemovePresentationPodEvtMsg => handleRemovePresentationPodEvtMsg(m)
case m: SetPresenterInPodRespMsg => handleSetPresenterInPodRespMsg(m)
case m: StoreAnnotationsInRedisSysMsg => handleStoreAnnotationsInRedisSysMsg(m)
case m: StoreExportJobInRedisSysMsg => handleStoreExportJobInRedisSysMsg(m)
// Whiteboard
case m: SendWhiteboardAnnotationEvtMsg => handleSendWhiteboardAnnotationEvtMsg(m)
@ -133,6 +135,16 @@ class RedisRecorderActor(
}
}
private def handleStoreAnnotationsInRedisSysMsg(msg: StoreAnnotationsInRedisSysMsg) {
println("These are the annotations lmao")
println(msg)
}
private def handleStoreExportJobInRedisSysMsg(msg: StoreExportJobInRedisSysMsg) {
println("This is the export message lol")
println(msg)
}
private def handleGroupChatMessageBroadcastEvtMsg(msg: GroupChatMessageBroadcastEvtMsg) {
if (msg.body.chatId == GroupChatApp.MAIN_PUBLIC_CHAT) {
val ev = new PublicChatRecordEvent()

View File

@ -3,6 +3,31 @@ package org.bigbluebutton.common2.msgs
case class AnnotationVO(id: String, status: String, annotationType: String,
annotationInfo: scala.collection.immutable.Map[String, Any], wbId: String, userId: String, position: Int)
case class PresentationPageForExport(
page: Int,
xOffset: Double,
yOffset: Double,
widthRatio: Double,
heightRatio: Double,
annotations: Array[AnnotationVO],
)
case class StoredAnnotations(
presId: String,
pages: Array[PresentationPageForExport],
)
case class ExportJob(
jobId: String,
jobType: String,
presId: String,
presLocation: String,
allPages: Boolean,
pages: Array[PresentationPageForExport],
parentMeetingId: String,
presUploadToken: String,
)
// ------------ client to akka-apps ------------
object ClientToServerLatencyTracerMsg { val NAME = "ClientToServerLatencyTracerMsg" }
case class ClientToServerLatencyTracerMsg(header: BbbClientMsgHeader, body: ClientToServerLatencyTracerMsgBody) extends StandardMsg
@ -65,4 +90,12 @@ case class SendWhiteboardAnnotationEvtMsgBody(annotation: AnnotationVO)
object UndoWhiteboardEvtMsg { val NAME = "UndoWhiteboardEvtMsg" }
case class UndoWhiteboardEvtMsg(header: BbbClientMsgHeader, body: UndoWhiteboardEvtMsgBody) extends BbbCoreMsg
case class UndoWhiteboardEvtMsgBody(whiteboardId: String, userId: String, annotationId: String)
// ------------ akka-apps to client ------------
object StoreAnnotationsInRedisSysMsg { val NAME = "StoreAnnotationsInRedisSysMsg" }
case class StoreAnnotationsInRedisSysMsg(header: BbbCoreBaseHeader, body: StoreAnnotationsInRedisSysMsgBody) extends BbbCoreMsg
case class StoreAnnotationsInRedisSysMsgBody(annotations: StoredAnnotations)
object StoreExportJobInRedisSysMsg { val NAME = "StoreExportJobInRedisSysMsg" }
case class StoreExportJobInRedisSysMsg(header: BbbCoreBaseHeader, body: StoreExportJobInRedisSysMsgBody) extends BbbCoreMsg
case class StoreExportJobInRedisSysMsgBody(exportJob: ExportJob)

View File

@ -30,9 +30,8 @@ const nextSlide = (currentSlideNum, numberOfSlides, podId) => {
};
const downloadAnnotatedSlides = () => {
makeCall('makePresentationWithAnnotationDownloadReqMsg')
makeCall('userActivitySign')
}
makeCall('makePresentationWithAnnotationDownloadReqMsg');
};
const zoomSlide = throttle((currentSlideNum, podId, widthRatio, heightRatio, xOffset, yOffset) => {
makeCall('zoomSlide', currentSlideNum, podId, widthRatio, heightRatio, xOffset, yOffset);

View File

@ -63,6 +63,8 @@ object AllowedMessageNames {
SetPresenterInPodReqMsg.NAME,
MakePresentationWithAnnotationDownloadReqMsg.NAME,
ExportPresentationWithAnnotationReqMsg.NAME,
StoreAnnotationsInRedisSysMsg.NAME,
StoreExportJobInRedisSysMsg.NAME,
// Whiteboard Messages
ModifyWhiteboardAccessPubMsg.NAME,