Stormpass / node-red-contrib-amqp

Amqp nodes for node-red
https://flows.nodered.org/node/@stormpass/node-red-contrib-amqp
2 stars 6 forks source link

Bug: RPC is only possible on default exchange #1

Closed mzeiher closed 11 months ago

mzeiher commented 1 year ago

Hi, with the current implementation RPC calls are only possible on the default exchange, because the exchange name is always overwritten with "": https://github.com/Stormpass/node-red-contrib-amqp/blob/3ee9e0ef7dadd30d8eefb8f36050e4a7fc5eb329/src/Amqp.ts#L201C33-L201C33

Maybe to also be able to do rpc calls on other exchanges this line should be changed?

Stormpass commented 1 year ago

I noticed this "overwritten" for exchange, but the exchange configured here is not used when actually sending the message. If you want to "call on other exchanges", you need to configure the exchange to be sent. Please provide more information if I'm misunderstanding you.

mzeiher commented 1 year ago

in rpc scenarios you usually create an autodelete queue for receiving messages and add a routing key, usually the defult direct exchange (empty string) has an implicit binding for the routing key to the queue for receiving messages, so if you get a message with replyTo you can send the answer on the direct exchange because of the implicit binding, but sometimes the queue is configured to not have the implicit binding and you have to send the message to a specific exchange. So it would be nice if would be possible to set a specific exchange instead always using direct and implicit routing

Stormpass commented 1 year ago

Suppose there is now a "test_queue" on the mq proxy bound to "testexchange" (direct), the bind key is "test key" Your program wants to listen to the test_queue , do some logical processing when it receives a message, and send the result to the "replyTo" queue.

In this case, you should configure the amqp-out node with the

image

At this moment, the amqp-out node listens to the replyTo queue, to which your program can send messages. In your question "...possible to set a specific exchange". Do you want to specify the exchange when you send the message or do you want to specify the queue at reply time in your program. If the former, I think it's currently possible to implement sending messages to a specific exchange, with a specific queue. If the latter, this should be specified in your program. I apologize if I misunderstood your question, please provide me with more information!