}
List<QueueEntry> messages = getMessages(startPosition, endPosition);
TabularDataSupport messageTable = new TabularDataSupport(MSG_LIST_DATA_TYPE);
// Create the tabular list of message header contents
long position = startPosition;
for (QueueEntry queueEntry : messages)
{
ServerMessage serverMsg = queueEntry.getMessage();
AMQMessageHeader header = serverMsg.getMessageHeader();
String[] headerAttributes =
{"reply-to = " + header.getReplyTo(),
"propertyFlags = ",
"ApplicationID = " + header.getAppId(),
"ClusterID = ",
"UserId = " + header.getUserId(),
"JMSMessageID = " + header.getMessageId(),
"JMSCorrelationID = " + header.getCorrelationId(),
"JMSDeliveryMode = " + (serverMsg.isPersistent() ? "Persistent" : "Non_Persistent"),
"JMSPriority = " + header.getPriority(),
"JMSType = " + header.getType(),
"JMSExpiration = " + (header.getExpiration() == 0 ? null : FAST_DATE_FORMAT.format(header.getExpiration())),
"JMSTimestamp = " + (header.getTimestamp() == 0 ? null : FAST_DATE_FORMAT.format(header.getTimestamp()))
};
Object[] itemValues = new Object[]{ serverMsg.getMessageNumber(),
headerAttributes,
serverMsg.getSize(),
queueEntry.isRedelivered(),
position,
queueEntry.getDeliveryCount()};
position++;
CompositeData messageData =
new CompositeDataSupport(MSG_DATA_TYPE, VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC_ARRAY, itemValues);
messageTable.put(messageData);
}
return messageTable;
}