1

我正在使用 rhea ( https://github.com/amqp/rhea ),一个 node.js 库来开发 AMQP 1.0 客户端。

我正在尝试使用x-match表达式而不是 JMS 表达式来调整https://github.com/amqp/rhea/tree/master/examples/selector示例。

目的是实现基于符合 AMQP 1.0 的代理(ActiveMQ、Qpid、...)的标头路由机制。

我在 recv.js 的相应部分尝试了这段代码:

connection.open_receiver({
    source: {
        address: 'amq.match',
        filter: {
            'x-match': 'all',
            value: {
                'nat': 'it',
                'prod': 'a22'
            }
        }
    }
})

从 Qpid Java 代理(版本 7.1.0)收到连接错误“预期值类型为 'Filter' 但得到 'String' amqp:decode-error”。

4

1 回答 1

1

根据在 rhea github repo 上收到的这个答案:

https://github.com/amqp/rhea/issues/200#issuecomment-469220880

过滤器需要是一个描述的值。尝试这样的事情:

connection.open_receiver({
    source: {
        address: 'amq.match',
        filter: {
            'foo': amqp_types.wrap_described({
                'nat': 'it',
                'prod': 'a22',
                'x-match': 'all'
            }, 0x468C00000002)
        }
    }
});

在哪里:

var amqp_types = require('rhea').types;

这仅适用于 Qpid cpp,不适用于 ActiveMQ 和 Qpid java。

于 2019-03-05T08:55:57.180 回答