【问题标题】:Solace nodejs api to retrieve message from message spool Queue安慰 nodejs api 从消息假脱机队列中检索消息
【发布时间】: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


    【解决方案1】:

    消息"Consumer is not supported by router for this client"表示问题出在远端。

    检查客户端配置文件是否允许客户端接收有保证的消息。否则,消息假脱机可能会出现问题,导致消息代理无法提供有保证的消息服务。

    问题中的代码 sn-p 仅用于启动连接,与连接队列无关。失败的操作应该是

    consumer.messageConsumer.connect();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-13
      • 2017-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-21
      • 2019-10-04
      相关资源
      最近更新 更多