Thanks, I just wrapped the whole CMS broker/sessions in another class to handle it. However, I noticed that if I close the producer/consumer before I close the broker/session it'll throw an exception. I think it was complaining about it already being closed. Anyway, I've got something working fairly well now its just a little hairy as to what needs to be closed/stopped before deleting sessions & brokers. For others listening, the order of destruction/shutdown that works for me is:
for(iSession = m_queues.begin(); iSession != m_queues.end(); iSession++){ iSession->second->close(); } for(iSession = m_topics.begin(); iSession != m_topics.end(); iSession++){ iSession->second->close(); } if (m_session){ m_session->close(); delete m_session; m_session = NULL; } if (m_connection){ m_connection->stop(); m_connection->close(); delete m_connection; m_connection = NULL; } >> Where session->close() does: << if(m_consumer){ //m_consumer->close(); << This fails later when broker/session deleted! delete m_consumer; m_consumer = NULL; } if(m_producer){ //m_producer->close(); << Same thing here, just left them open delete m_producer; m_producer = NULL; } if(m_destination){ delete m_destination; m_destination = NULL; } Tim Bish wrote: > > You must destroy the connection and create a new connection / session > etc. We don't have a fail over transport but you are welcome to write > one and donate it :) > > Fred Crable wrote: >> Is there a best practice for gracefully restarting an openwire/c++ >> consumer >> or producer session. I'm hesitant to destroy and rebuild the connection, >> session, and all of the consumers when I get an connection exception in >> my >> exception listener. I can't use failover:tcp: in an openwire broker uri. >> Do I really have to unwind/destroy all of my consumer handles? I've >> looked >> all over for some methods or hints but I don't see any examples of >> reconnecting after a client connection failure. >> >> Thanks, >> Fred >> > > > -- View this message in context: http://www.nabble.com/gracefully-restarting-a-c%2B%2B-openwire-session-tf4603637s2354.html#a13202868 Sent from the ActiveMQ - User mailing list archive at Nabble.com.