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: http://activemq.apache.org/cms/configuring.html

Regards

-- 
Tim Bish
------------
FuseSource
Email: tim.b...@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/


Reply via email to