https://issues.apache.org/jira/browse/AMQ-3695 - ensure destination deletion removes entry in the acks table

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1240994 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-02-06 12:05:17 +00:00
parent c35550f165
commit e73230b4a3
2 changed files with 27 additions and 2 deletions

View File

@ -201,11 +201,29 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist
/** /**
* Cleanup method to remove any state associated with the given destination * Cleanup method to remove any state associated with the given destination
* No state retained.... nothing to do
*
* @param destination Destination to forget * @param destination Destination to forget
*/ */
public void removeQueueMessageStore(ActiveMQQueue destination) { public void removeQueueMessageStore(ActiveMQQueue destination) {
if (destination.isQueue() && getBrokerService().shouldRecordVirtualDestination(destination)) {
try {
removeConsumerDestination(destination);
} catch (IOException ioe) {
LOG.error("Failed to remove consumer destination: " + destination, ioe);
}
}
}
private void removeConsumerDestination(ActiveMQQueue destination) throws IOException {
TransactionContext c = getTransactionContext();
try {
String id = destination.getQualifiedName();
getAdapter().doDeleteSubscription(c, destination, id, id);
} catch (SQLException e) {
JDBCPersistenceAdapter.log("JDBC Failure: ", e);
throw IOExceptionSupport.create("Failed to remove consumer destination: " + destination, e);
} finally {
c.close();
}
} }
/** /**

View File

@ -97,4 +97,11 @@ abstract public class PersistenceAdapterTestSupport extends TestCase {
} }
public void testAddRemoveConsumerDest() throws Exception {
ActiveMQQueue consumerQ = new ActiveMQQueue("Consumer.A.VirtualTopicTest");
MessageStore ms = pa.createQueueMessageStore(consumerQ);
pa.removeQueueMessageStore(consumerQ);
assertFalse(pa.getDestinations().contains(consumerQ));
}
} }