List/Hash data structure in Redis for messages; add jobId in annotations format
This commit is contained in:
parent
3c2aa14907
commit
e5dec08ab9
@ -27,6 +27,10 @@ class StorePresentationAnnotationsRecordEvent extends AbstractPresentationWithAn
|
||||
|
||||
setEvent("StorePresentationAnnotationsRecordEvent")
|
||||
|
||||
def setJobId(jobId: String) {
|
||||
eventMap.put(JOB_ID, jobId)
|
||||
}
|
||||
|
||||
def setPresId(presId: String) {
|
||||
eventMap.put(PRES_ID, presId)
|
||||
}
|
||||
@ -37,6 +41,7 @@ class StorePresentationAnnotationsRecordEvent extends AbstractPresentationWithAn
|
||||
}
|
||||
|
||||
object StorePresentationAnnotationsRecordEvent {
|
||||
protected final val JOB_ID = "jobId"
|
||||
protected final val PRES_ID = "presId"
|
||||
protected final val PAGES = "pages"
|
||||
}
|
||||
|
@ -778,12 +778,13 @@ class MeetingActor(
|
||||
resultingPage += 1
|
||||
}
|
||||
|
||||
val jobId = RandomStringGenerator.randomAlphanumericString(16)
|
||||
|
||||
// 1) Send Annotations to Redis
|
||||
var annotations = new StoredAnnotations(presId, storeAnnotationPages)
|
||||
var annotations = new StoredAnnotations(jobId, presId, storeAnnotationPages)
|
||||
outGW.send(buildStoreAnnotationsInRedisSysMsg(annotations))
|
||||
|
||||
// 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, presId, presLocation, allPages, storeAnnotationPages, "", "")
|
||||
@ -823,16 +824,16 @@ class MeetingActor(
|
||||
}
|
||||
|
||||
val presentationUploadToken: String = PresentationPodsApp.generateToken("DEFAULT_PRESENTATION_POD", userId)
|
||||
val jobId = RandomStringGenerator.randomAlphanumericString(16)
|
||||
|
||||
// Informs bbb-web about the token so that when we use it to upload the presentation, it is able to look it up in the list of tokens
|
||||
outGW.send(buildPresentationUploadTokenSysPubMsg(parentMeetingId, userId, presentationUploadToken, currentPres.name))
|
||||
|
||||
// 1) Send Annotations to Redis
|
||||
var annotations = new StoredAnnotations(presId, storeAnnotationPages)
|
||||
var annotations = new StoredAnnotations(jobId, presId, storeAnnotationPages)
|
||||
outGW.send(buildStoreAnnotationsInRedisSysMsg(annotations))
|
||||
|
||||
// 2) Insert Export Job in Redis
|
||||
val jobId = RandomStringGenerator.randomAlphanumericString(16)
|
||||
val jobType: String = "PresentationWithAnnotationExportJob"
|
||||
val presLocation = s"/var/bigbluebutton/${presId}"
|
||||
val exportJob = new ExportJob(jobId, jobType, presId, presLocation, allPages, storeAnnotationPages, parentMeetingId, presentationUploadToken)
|
||||
|
@ -114,8 +114,8 @@ 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: StoreAnnotationsInRedisSysMsg => logMessage(msg)
|
||||
// case m: StoreExportJobInRedisSysMsg => logMessage(msg)
|
||||
case m: MakePresentationWithAnnotationDownloadReqMsg => logMessage(msg)
|
||||
case m: ExportPresentationWithAnnotationReqMsg => logMessage(msg)
|
||||
case m: PresentationPageConversionStartedSysMsg => logMessage(msg)
|
||||
|
@ -142,6 +142,7 @@ class RedisRecorderActor(
|
||||
private def handleStoreAnnotationsInRedisSysMsg(msg: StoreAnnotationsInRedisSysMsg) {
|
||||
val ev = new StorePresentationAnnotationsRecordEvent()
|
||||
|
||||
ev.setJobId(msg.body.annotations.jobId)
|
||||
ev.setPresId(msg.body.annotations.presId)
|
||||
ev.setPages(msg.body.annotations.pages)
|
||||
|
||||
|
@ -21,6 +21,8 @@ package org.bigbluebutton.common2.redis;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import io.lettuce.core.api.sync.BaseRedisCommands;
|
||||
import org.slf4j.Logger;
|
||||
@ -113,11 +115,29 @@ public class RedisStorageService extends RedisAwareCommunicator {
|
||||
}
|
||||
|
||||
public void storePresentationAnnotations(String meetingId, Map<String, String> event, String msgType) {
|
||||
RedisCommands<String, String> commands = connection.sync();
|
||||
Long msgid = commands.incr("global:nextRecordedMsgId");
|
||||
RedisCommands<String, String> commands = connection.sync();
|
||||
|
||||
commands.multi();
|
||||
commands.hmset("store" + msgType + ":" + meetingId + ":" + msgid, event);
|
||||
commands.rpush("meeting:" + meetingId + ":" + "store" + msgType, Long.toString(msgid));
|
||||
|
||||
switch (msgType) {
|
||||
case "Annotations": {
|
||||
commands.hmset(event.get("jobId"), event);
|
||||
break;
|
||||
}
|
||||
|
||||
case "ExportJob": {
|
||||
Gson gson = new Gson();
|
||||
String exportJobAsJson = gson.toJson(event);
|
||||
commands.rpush("exportJobs", exportJobAsJson.toString());
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
log.error("Attempted to store PresentationAnnotations message of type: {} (expected 'Annotations' or 'ExportJob')", clientName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
commands.exec();
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ case class PresentationPageForExport(
|
||||
)
|
||||
|
||||
case class StoredAnnotations(
|
||||
jobId: String,
|
||||
presId: String,
|
||||
pages: Array[PresentationPageForExport],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user