I was use stompit module for connect activeMQ in node js.
My problem : Unable to identify whether broker is connected or not in stompit.ConnectFailover
Here is my code:
var stompit = require('stompit')
var connectionManager = new stompit.ConnectFailover();
connectionManager.addServer({
'host': 'localhost',
'port': 61623,
'connectHeaders':{
...
}
});
var channel = new stompit.Channel(connectionManager);
var subscribeHeaders = {
'destination': '/queue/test',
'ack': 'client'
};
channel.subscribe(subscribeHeaders, function(error, message){
if (error) {
console.log(error);
return;
}
});
//send . But not throw error , even broker is not started
//always trying to reconnect
sendDlQ(subscribeHeaders, 'Hello');
function sendDlQ(header, body){
channel.send(header, body);
}
Whenever call send method , always success. Even broker is not started.
How to identify broker is connected or not before send ?
Already connection option available from Channel.js from stompit library
check if(channel._client != null && !channel._closed)