Added redis messages for the events of Publish, Unpublish and Remove recordings triggered by the API calls.

refs #1693
This commit is contained in:
RafaFP 2016-01-22 20:47:34 +00:00
parent a340103fad
commit 19bae41130
12 changed files with 182 additions and 2 deletions

View File

@ -1582,6 +1582,14 @@ class ApiController {
}
}
}
//TESTING HERE FOR MESSAGE
if (publish == "true"){
meetingService.publishRecording(params.meetingID,params.recordID);
}
if (publish == "false"){
meetingService.unpublishRecording(params.meetingID,params.recordID);
}
}
/******************************************************
@ -1660,6 +1668,7 @@ class ApiController {
}
}
}
meetingService.deleteRecording(params.meetingID,params.recordID);
}
def uploadDocuments(conf) {

View File

@ -47,13 +47,16 @@ import org.bigbluebutton.api.messaging.MessagingConstants;
import org.bigbluebutton.api.messaging.MessagingService;
import org.bigbluebutton.api.messaging.ReceivedMessage;
import org.bigbluebutton.api.messaging.messages.CreateMeeting;
import org.bigbluebutton.api.messaging.messages.DeleteRecording;
import org.bigbluebutton.api.messaging.messages.EndMeeting;
import org.bigbluebutton.api.messaging.messages.IMessage;
import org.bigbluebutton.api.messaging.messages.MeetingDestroyed;
import org.bigbluebutton.api.messaging.messages.MeetingEnded;
import org.bigbluebutton.api.messaging.messages.MeetingStarted;
import org.bigbluebutton.api.messaging.messages.PublishRecording;
import org.bigbluebutton.api.messaging.messages.RegisterUser;
import org.bigbluebutton.api.messaging.messages.RemoveExpiredMeetings;
import org.bigbluebutton.api.messaging.messages.UnpublishRecording;
import org.bigbluebutton.api.messaging.messages.UserJoined;
import org.bigbluebutton.api.messaging.messages.UserJoinedVoice;
import org.bigbluebutton.api.messaging.messages.UserLeft;
@ -794,7 +797,14 @@ public class MeetingService implements MessageListener {
processEndMeeting((EndMeeting)message);
} else if (message instanceof RegisterUser) {
processRegisterUser((RegisterUser) message);
}
} else if (message instanceof PublishRecording){
processPublishRecording((PublishRecording)message);
} else if (message instanceof UnpublishRecording){
processUnpublishRecording((UnpublishRecording)message);
} else if (message instanceof DeleteRecording){
processDeleteRecording((DeleteRecording)message);
}
}
};
@ -862,4 +872,28 @@ public class MeetingService implements MessageListener {
public void setRemoveMeetingWhenEnded(boolean s) {
removeMeetingWhenEnded = s;
}
public void publishRecording(String meetingID, String recordingID) {
handle(new PublishRecording(meetingID, recordingID));
}
private void processPublishRecording(PublishRecording message) {
messagingService.publishRecording(message.meetingID, message.recordingID);
}
public void unpublishRecording(String meetingID, String recordingID) {
handle(new UnpublishRecording(meetingID, recordingID));
}
private void processUnpublishRecording(UnpublishRecording message) {
messagingService.unpublishRecording(message.meetingID, message.recordingID);
}
public void deleteRecording(String meetingID, String recordingID) {
handle(new DeleteRecording(meetingID, recordingID));
}
private void processDeleteRecording(DeleteRecording message) {
messagingService.deleteRecording(message.meetingID, message.recordingID);
}
}

View File

@ -7,6 +7,9 @@ import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage
import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage;
import org.bigbluebutton.api.messaging.converters.messages.KeepAliveMessage;
import org.bigbluebutton.api.messaging.converters.messages.RegisterUserMessage;
import org.bigbluebutton.api.messaging.converters.messages.PublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.UnpublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.DeleteRecordingMessage;
public class MessageToJson {
@ -68,5 +71,31 @@ public class MessageToJson {
return MessageBuilder.buildJson(header, payload);
}
public static String publishRecordingMessageToJson(PublishRecordingMessage message) {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, message.meetingID);
payload.put(Constants.RECORDING, message.recordingID);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(PublishRecordingMessage.PUBLISH_RECORDING, message.VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static String unpublishRecordingMessageToJson(UnpublishRecordingMessage message) {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, message.meetingID);
payload.put(Constants.RECORDING, message.recordingID);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(UnpublishRecordingMessage.UNPUBLISH_RECORDING, message.VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static String deleteRecordingMessageToJson(DeleteRecordingMessage message) {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, message.meetingID);
payload.put(Constants.RECORDING, message.recordingID);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(DeleteRecordingMessage.DELETE_RECORDING, message.VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
}

View File

@ -53,7 +53,10 @@ public class MessagingConstants {
public static final String USER_SHARE_WEBCAM_EVENT = "user_shared_webcam_message";
public static final String USER_UNSHARE_WEBCAM_EVENT = "user_unshared_webcam_message";
public static final String USER_ROLE_CHANGE_EVENT = "user_role_changed_message";
public static final String RECORDING_PUBLISHED_EVEN = "recording_publish_message";
public static final String RECORDING_UNPUBLISHED_EVENT = "recording_unpublish_message";
public static final String RECORDING_DELETED_EVENT = "recording_deleted_message";
public static final String SEND_POLLS_EVENT = "SendPollsEvent";
public static final String KEEP_ALIVE_REPLY = "keep_alive_reply";

View File

@ -34,4 +34,7 @@ public interface MessagingService {
void sendPolls(String meetingId, String title, String question, String questionType, List<String> answers);
void registerUser(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken, String guest);
void sendKeepAlive(String keepAliveId);
void publishRecording(String meetingID, String recordingID);
void unpublishRecording(String meetingID, String recordingID);
void deleteRecording(String meetingID, String recordingID);
}

View File

@ -33,6 +33,9 @@ import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage
import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage;
import org.bigbluebutton.api.messaging.converters.messages.KeepAliveMessage;
import org.bigbluebutton.api.messaging.converters.messages.RegisterUserMessage;
import org.bigbluebutton.api.messaging.converters.messages.PublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.UnpublishRecordingMessage;
import org.bigbluebutton.api.messaging.converters.messages.DeleteRecordingMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
@ -124,4 +127,25 @@ public class RedisMessagingService implements MessagingService {
storeService.removeMeeting(meetingId);
}
public void publishRecording(String meetingID, String recordingID) {
PublishRecordingMessage msg = new PublishRecordingMessage(meetingID, recordingID);
String json = MessageToJson.publishRecordingMessageToJson(msg);
log.info("Sending Recording has been Published message:[{}]", json);
sender.send(MessagingConstants.RECORDING_PUBLISHED_EVENT, json);
}
public void unpublishRecording(String meetingID, String recordingID) {
UnpublishRecordingMessage msg = new UnpublishRecordingMessage(meetingID, recordingID);
String json = MessageToJson.unpublishRecordingMessageToJson(msg);
log.info("Sending Recording has been Unublished message:[{}]", json);
sender.send(MessagingConstants.RECORDING_UNPUBLISHED_EVENT, json);
}
public void deleteRecording(String meetingID, String recordingID) {
DeleteRecordingMessage msg = new DeleteRecordingMessage(meetingID, recordingID);
String json = MessageToJson.deleteRecordingMessageToJson(msg);
log.info("Sending Recording has been Deleted message:[{}]", json);
sender.send(MessagingConstants.RECORDING_DELETED_EVENT, json);
}
}

View File

@ -0,0 +1,14 @@
package org.bigbluebutton.api.messaging.converters.messages;
public class DeleteRecordingMessage {
public static final String DELETE_RECORDING = "delete_recording";
public final String VERSION = "0.0.1";
public final String meetingID;
public final String recordingID;
public DeleteRecordingMessage(String meetingID, String recordingID) {
this.meetingID = meetingID;
this.recordingID = recordingID;
}
}

View File

@ -0,0 +1,14 @@
package org.bigbluebutton.api.messaging.converters.messages;
public class PublishRecordingMessage {
public static final String PUBLISH_RECORDING = "publish_recording";
public final String VERSION = "0.0.1";
public final String meetingID;
public final String recordingID;
public PublishRecordingMessage(String meetingID, String recordingID) {
this.meetingID = meetingID;
this.recordingID = recordingID;
}
}

View File

@ -0,0 +1,14 @@
package org.bigbluebutton.api.messaging.converters.messages;
public class UnpublishRecordingMessage {
public static final String UNPUBLISH_RECORDING = "unpublish_recording";
public final String VERSION = "0.0.1";
public final String meetingID;
public final String recordingID;
public UnpublishRecordingMessage(String meetingID, String recordingID) {
this.meetingID = meetingID;
this.recordingID = recordingID;
}
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.api.messaging.messages;
public class DeleteRecording implements IMessage {
public final String meetingID;
public final String recordingID;
public DeleteRecording(String meetingID, String recordingID) {
this.meetingID = meetingID;
this.recordingID = recordingID;
}
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.api.messaging.messages;
public class PublishRecording implements IMessage {
public final String meetingID;
public final String recordingID;
public PublishRecording(String meetingID, String recordingID) {
this.meetingID = meetingID;
this.recordingID = recordingID;
}
}

View File

@ -0,0 +1,12 @@
package org.bigbluebutton.api.messaging.messages;
public class UnpublishRecording implements IMessage {
public final String meetingID;
public final String recordingID;
public UnpublishRecording(String meetingID, String recordingID) {
this.meetingID = meetingID;
this.recordingID = recordingID;
}
}