skyscreamer / nevado

A JMS driver for Amazon SQS.

Home Page:http://nevado.skyscreamer.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clean up temporary queues and topics

carterpage opened this issue · comments

In the event of a failure or unclean shutdown, temporary queues and topics can be left behind. Provide a catch-all mechanism for cleaning up old artifact queues and topics.

Reported by: @gskaplan

New functionality to be released in 1.2.3. You can ask a Connection to remove all queues or topics with a given suffix, that it does not know about. (If another Connection object is using them, however, they may be considered unused.)

public void deleteUnusedTemporaryQueues() throws Exception {
    Collection<NevadoTemporaryQueue> deletedQueues = 
        getConnection().deleteUnusedTemporaryQueues("_suffix);
    for (NevadoTemporaryQueue queue : deletedQueues) {
        _log.warn("Deleted queue: " + queue);
    }
}

Another note here to anyone that encounters this issue. Always close your connections in a try/finally block, as you would do for a database. This ensures that cleanup occurs even when something goes wrong.

Connection conn = connectionFactory.getConnection();
try {
    <do stuff>
} finally {
    try { conn.close(); } catch (Throwable t) { ... log an error ... }
}

Hi Carter,

I started my application in the development environment (in Eclipse) and did a bunch of bogus source code changes just to see if I could cause the system to hang during republish. Until now, I have not seen the behavior that was causing grief before, however the changes have not been as intense as if it were some real development going on (most of my development on this project is complete at this time). From what I can tell, the problem has not reoccurred, but if it does, I will certainly let you know.

Thanks!
Gerry

From: Carter Page [mailto:notifications@github.com]
Sent: Tuesday, July 09, 2013 6:02 PM
To: skyscreamer/nevado
Cc: Gerry Kaplan
Subject: Re: [nevado] Clean up temporary queues and topics (#53)

Another note here to anyone that encounters this issue. Always close your connections in a try/finally block, as you would do for a database. This ensures that cleanup occurs even when something goes wrong.

Connection conn = connectionFactory.getConnection();

try {

<do stuff>

} finally {

try { conn.close(); } catch (Throwable t) { ... log an error ... }

}


Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-20708781.

Thanks. We can always reopen if necessary.