logger.debug(String.format("Received message [version:%s][message type:%s][body length:%s][body:%s]",
messageVersion, messageType, bodyLength, sb.toString().trim()));
}
try {
RexProSerializer serializer;
if (serializerType == msgPackSerializer.getSerializerId()){
serializer = msgPackSerializer;
} else if (serializerType == jsonSerializer.getSerializerId()) {
serializer = jsonSerializer;
} else {
throw new RexProException(String.format("unknown serializer type: %s", serializerType));
}
RexProMessage message = null;
if (messageType == MessageType.SCRIPT_REQUEST) {
message = serializer.deserialize(messageAsBytes, ScriptRequestMessage.class);
} else if (messageType == MessageType.SESSION_REQUEST) {
message = serializer.deserialize(messageAsBytes, SessionRequestMessage.class);
} else if (messageType == MessageType.SESSION_RESPONSE) {
message = serializer.deserialize(messageAsBytes, SessionResponseMessage.class);
} else if (messageType == MessageType.ERROR) {
message = serializer.deserialize(messageAsBytes, ErrorResponseMessage.class);
} else if (messageType == MessageType.SCRIPT_RESPONSE) {
message = serializer.deserialize(messageAsBytes, ScriptResponseMessage.class);
}
if (message == null) {
logger.warn(String.format("Message did not match the specified type [%s]", messageType));