I have a small Node JS application using the amqp10 library. The issue I have is that if the queue name I try to connect to does not exist the amqp10 library swallows the error and my application is stuck waiting for a response.
The code I use is the following:
client.connect(uri)
.then(function () {
return Promise.all([
client.createSender(topicName),
client.createReceiver(topicName + '/Subscriptions/' + subscriptionName)
]);
})
.spread(function(sender, receiver) {
// error handling
sender.on('errorReceived', sendError);
receiver.on('errorReceived', recvError);
// message event handler
receiver.on('message', newMessage);
// send test message
return sender.send({ DataString: 'from node', DataValue: msgVal }).then(function(state) {
// this can be used to optionally track the disposition of the sent message
console.log('state: ', state);
});
})
.error(function (e) {
console.warn('connection error: ', e);
});
What should I do to get a notification about that the queue does not exist? The spread function is called when both create have failed. (In my case either non or both fails).
/Morgan
via Morgan Lindqvist
No comments:
Post a Comment