throws JMSException, PersistenceException {
String name = consumer.getName();
JmsDestination destination = subscription.getDestination();
Iterator iterator = subscription.getMessages().iterator();
PersistenceAdapter adapter = _database.getAdapter();
Connection connection = _database.getConnection();
if (!consumer.isQueueConsumer()) {
adapter.addDurableConsumer(connection, destination.getName(), name);
}
while (iterator.hasNext()) {
MessageState state = (MessageState) iterator.next();
MessageImpl message = adapter.getMessage(connection,
state.getMessageId());
PersistentMessageHandle handle =
new PersistentMessageHandle(message.getJMSMessageID(),
message.getJMSPriority(),
message.getAcceptedTime(),