【发布时间】:2018-11-23 22:33:23
【问题描述】:
在通过 Nodejs api 连接到 Solace 消息持久性队列时,我们遇到错误:
{"message":"此客户端的路由器不支持消费者","name":"OperationError","subcode":3,"reason":null}
关于使用 Solace Node.js API 示例使用 soladmin 通过 Web 消息 URI 连接到持久性消息队列。
consumer.connect = function (argv) {
if (consumer.session !== null) {
consumer.log('Already connected and ready to consume messages.');
return;
}
// extract params
//if (argv.length < (2 + 3)) { // expecting 3 real arguments
if (argv.length < 4) {
consumer.log('Cannot connect: expecting all arguments' +
'[<protocol://host[:port]>, <client-username>, <message-vpn>, <client-password>].\n' +
'Available protocols are ws://, wss://, http://, https://');
process.exit();
}
var hosturl = argv[0] //argv.slice(2)[0];
consumer.log('Connecting to Solace message router using url: ' + hosturl);
//var usernamevpn = argv.slice(3)[0];
var username = argv[1]//usernamevpn.split('@')[0];
consumer.log('Client username: ' + username);
var vpn = argv[2]//usernamevpn.split('@')[1];
consumer.log('Solace message router VPN name: ' + vpn);
var pass = argv[3]//argv.slice(4)[0];
// create session
try {
consumer.session = solace.SolclientFactory.createSession({
// solace.SessionProperties
url: hosturl,
vpnName: vpn,
userName: username,
password: pass,
});
} catch (error) {
consumer.log(error.toString());
}
【问题讨论】:
标签: node.js message-queue solace