I am developing a software that uses ActiveMQ
C++ library. The problem that I have is, when I try to send a message and the network is down, the send method (method of cms::MessageProducer
class) blocks forever and I need to recover the control in this case.
I am using persistent deliver mode (It is compulsory, I can't avoid it).
Do you set the sendTimeout when you create ActiveMQConnectionFactory
? It is set to 0 by default, which means "infinite".
auto_ptr<ActiveMQConnectionFactory> connectionFactory(
new ActiveMQConnectionFactory( brokerURI ) );
connectionFactory->setSendTimeout( 1000 ); // number of milliseconds
// ...
// creating Session and MessageProducer as usually