return rval;
}
public MessageSet toMessageSet(Collection messages) throws JMSException {
try {
MessageSet messageSet = factory.createMessageSet();
for (Iterator iter = messages.iterator(); iter.hasNext();) {
Message jmsMessage = (Message) iter.next();
Entry entry = factory.createEntry();
XMLMessage xmlMessage = createXMLMessage(factory, jmsMessage);
if (xmlMessage instanceof XMLTextMessage) {
entry.setType(XML_TEXT_MESSAGE);
entry.setTextMessage((XMLTextMessage) xmlMessage);
} else if (xmlMessage instanceof XMLMapMessage) {
entry.setType(XML_MAP_MESSAGE);
entry.setMapMessage((XMLMapMessage) xmlMessage);
} else if (xmlMessage instanceof XMLObjectMessage) {
entry.setType(XML_OBJECT_MESSAGE);
entry.setObjectMessage((XMLObjectMessage) xmlMessage);
} else if (xmlMessage instanceof XMLBytesMessage) {
entry.setType(XML_BYTES_MESSGAE);
entry.setBytesMessage((XMLBytesMessage) xmlMessage);
}
messageSet.getEntry().add(entry);
}
return messageSet;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);