activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject Re: ActiveMQ-cpp: Check if ActiveMQ server is running
Date Wed, 08 Dec 2010 13:22:34 GMT
On Wed, 2010-12-08 at 05:17 -0800, joost wrote:
> I use ActiveMQ-cpp to make a connection with an AcitveMQ server. The
> CMSConnection is started with: 
>         // Create a ConnectionFactory 
>         auto_ptr<ConnectionFactory> connectionFactory( 
>             ConnectionFactory::createCMSConnectionFactory( brokerURI ) ); 
>         // Create a Connection 
>         connection = connectionFactory->createConnection(); 
>         connection->start(); 
> This works fine if the ActiveMQ server is running, but when the user forgets
> to start the ActiveMQ server before starting my application, the application
> hangs in the function CMSConnection::start(). Is there a way to check if a
> connection can be made with the ActiveMQ server before starting the
> connection, or maybe a timeout on CMSConnection->start() is possible? 
> Joost 

The failover transport is probably in use so the hang at start is normal
as the client is waiting for a broker to connect to before proceeding.
You can play around with the failover transport options if you really
want it to fail.  See:


Tim Bish
Twitter: tabish121

View raw message