Created
January 30, 2016 14:52
-
-
Save dangnhdev/0d750889af5a4ccae82b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private AcmClientReqMsg getObjectFromJSon(MapMessage msg) { | |
try { | |
String msgContent = msg.getString("msgContent"); | |
String msgType = msg.getString("msgType"); | |
switch (msgType) { | |
case "MsgType1": | |
return gson.fromJson(msgContent, MsgType1.class); | |
case "MsgType2": | |
return gson.fromJson(msgContent, MsgType2.class); | |
case "MsgType3": | |
return gson.fromJson(msgContent, MsgType3.class); | |
case "MsgType4": | |
return gson.fromJson(msgContent, MsgType4.class); | |
....... | |
case "MsgType50": | |
return gson.fromJson(msgContent, MsgType50.class); | |
default: | |
logger.info("Unknown message type"); | |
return null; | |
} | |
} catch (JMSException ex) { | |
logger.error("Error when consumer read message: " + ex.getMessage() + "Stack trace: ", ex); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment