If you want to process those messages with some Java utility, you can still get the content of the message this way:
Enumeration msgs = queueBrowser.getEnumeration();
while (msgs.hasMoreElements()) {
Message tempMsg = (Message)msgs.nextElement();
String msgContent = "";
if (tempMsg instanceof BytesMessage) {
weblogic.jms.common.BytesMessageImpl bm = (weblogic.jms.common.BytesMessageImpl)tempMsg;
msgContent = new String(bm.getBodyBytes());
}
if (tempMsg instanceof TextMessage) {
msgContent = ((TextMessage)tempMsg).getText();
}
}
the method getBodyBytes() is not part of the BytesMessage interface, but it's very convenient...
I guess that the message body COULD be compressed, in that case you are screwed, you might try decompressMessageBody() before reading the body, not sure...
No comments:
Post a Comment