If consumers crash or exit without cleanly closing their connections, then sometime after the connection TTL time, the server should automatically close them on the server which would result in any delivered but unacknowledged messages going back on their queue(s).
Default connection ttl is quite long, this allows users to reconnect to any detached sessions on the server, after network problems etc.
If you'd like to reduce connection ttl to a lower value this can be done by setting the param on the connection factory or session factory.
Sometimes the server can take up 2 * connection TTL to actually clear up the connection, this is because it checks the connection state after connection TTL ms to see if any data has been received since the last time. So the first time it checks it the answer is yes, but the second time it is now.
We could do a little bit of work to make it never wait much more than connection ttl, but in all cases I have seen so far, connection was eventually cleared up.
thanks, I'll see what happens if I play with the TTL.