Node-red 如何将模式与 amqp 库和变量一起使用
Node-red How to use Pattern with amqp lib and variable
我在这个库中使用 Node-Red:node-red-contrib-amqp。
我正在连接到 RabbitMQ 服务器 (AMQP),以使用路由键从主题中获取一些消息。
节点 AMQP 有一个选项卡,您可以在其中定义拓扑和 routing_key 用于侦听具有特定路由的消息(AMQP 协议的功能)。
这就是帮助:
In the topology tab you can define the AMQP server exchange and queue
topology (exchanges, queues and bindings). You define the topology in
the JSON editor.
Topology configuration example:
{
"exchanges": [
{"name": "exchange1", "type": "direct", "options": {"durable": false}},
{"name": "exchange2"}
],
"queues": [
{"name": "queue1", "options": {"messageTtl": 60000}},
{"name": "queue2"}
],
"bindings": [
{"source": "exchange1", "queue": "queue1", "pattern": "debug", "args": {}},
{"source": "exchange1", "exchange": "exchange2", "pattern": "error"},
{"source": "exchange2", "queue": "queue2"}
]
};
我想问问是否有人知道如何使用该模式,但使用来自 Node-red 的变量。例如我使用了这个模式:
{"source": "exchange_1", "exchange": "queue_name_1", "pattern": "*.*.rabbit"},
我想要这样的东西:
{"source": "exchange_1", "exchange": "queue_name_1", "pattern": {inject_node.msg.payload}},
其中inject_node是一个带有字符串输入的注入节点。这样做的想法是根据 Flow 上的某些功能根据其他结果更改模式。我的意思是模式可能是“#”或“.orange.”(来自 RabbitMQ 教程的示例),但会根据某些函数结果发生变化。
到目前为止,我有几个配置了特定模式的 AMQP 服务器,但这不是我的想法。
我有:
- Node-RED 版本:v0.19.4
- Node.js版本:v10.9.0
- Linux4.4.0-1069-aws x64 LE(亚马逊虚拟服务器Ubuntu)
- RabbitMQ 3.7
不,拓扑是 AMQP-in
和 AMQP-out
节点的基础配置节点的 属性。
随着节点的写入,无法在 运行 时更改它。
我在这个库中使用 Node-Red:node-red-contrib-amqp。 我正在连接到 RabbitMQ 服务器 (AMQP),以使用路由键从主题中获取一些消息。
节点 AMQP 有一个选项卡,您可以在其中定义拓扑和 routing_key 用于侦听具有特定路由的消息(AMQP 协议的功能)。
这就是帮助:
In the topology tab you can define the AMQP server exchange and queue topology (exchanges, queues and bindings). You define the topology in the JSON editor.
Topology configuration example:
{
"exchanges": [
{"name": "exchange1", "type": "direct", "options": {"durable": false}},
{"name": "exchange2"}
],
"queues": [
{"name": "queue1", "options": {"messageTtl": 60000}},
{"name": "queue2"}
],
"bindings": [
{"source": "exchange1", "queue": "queue1", "pattern": "debug", "args": {}},
{"source": "exchange1", "exchange": "exchange2", "pattern": "error"},
{"source": "exchange2", "queue": "queue2"}
]
};
我想问问是否有人知道如何使用该模式,但使用来自 Node-red 的变量。例如我使用了这个模式:
{"source": "exchange_1", "exchange": "queue_name_1", "pattern": "*.*.rabbit"},
我想要这样的东西:
{"source": "exchange_1", "exchange": "queue_name_1", "pattern": {inject_node.msg.payload}},
其中inject_node是一个带有字符串输入的注入节点。这样做的想法是根据 Flow 上的某些功能根据其他结果更改模式。我的意思是模式可能是“#”或“.orange.”(来自 RabbitMQ 教程的示例),但会根据某些函数结果发生变化。
到目前为止,我有几个配置了特定模式的 AMQP 服务器,但这不是我的想法。
我有:
- Node-RED 版本:v0.19.4
- Node.js版本:v10.9.0
- Linux4.4.0-1069-aws x64 LE(亚马逊虚拟服务器Ubuntu)
- RabbitMQ 3.7
不,拓扑是 AMQP-in
和 AMQP-out
节点的基础配置节点的 属性。
随着节点的写入,无法在 运行 时更改它。