activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From philipyao <>
Subject ApacheNMS: How to "Open" a closed connection?
Date Thu, 27 Sep 2012 08:04:28 GMT
Hi guys!

I am new to activeMq and I have some problems when starting a connection
after being created. 
It always throws a ConnectionClosedException which says something like
"Connection is already closed".

I have read attempting to create a connection through a while loop worked
for them but it's has not on my end. :(  
Other attempts, I've tried to 
          - attach "failover:" text on the url. 
          - Using with and without user credentials on creating the
Connection object. 

Below is my code:

                bool connected = false;
                Connection conn =

                int times = 0;
                while (!connected)
                    Console.WriteLine("Trying" + times.ToString());
                        connected = conn.IsStarted;                        
                        conn =

My question now is there a way to open a connection through code?
By the way, I dont have a clientId when creating an instance of the
Connection Factory, I only use the one with only the url as the parameter. 
So basically, I am assuming that I am connecting through the
defaultClientId.  Also, does the clientId really matter when starting

Any help would be greatly appreciated!


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message