use of org.apache.qpid.jms.message.JmsTextMessage in project syndesis-qe by syndesisio.
the class JMSUtils method getMessageText.
public static String getMessageText(String appName, String jmsProtocol, String user, String pass, Destination type, String destinationName) {
Message m = getMessage(appName, jmsProtocol, user, pass, type, destinationName, 60000L);
if (m == null) {
return null;
}
String text = null;
try {
if (m instanceof JmsTextMessage) {
text = ((JmsTextMessage) m).getText();
} else if (m instanceof ActiveMQBytesMessage) {
text = new String(((ActiveMQBytesMessage) m).getContent().getData());
} else {
text = ((ActiveMQTextMessage) m).getText();
}
} catch (JMSException e) {
log.error("Unable to get text from message", e);
e.printStackTrace();
}
log.debug("Got message: " + text);
return text;
}
Aggregations