Open jfromaniello opened 6 years ago
The receiver part works OK, I can actually receive messages, sent by other means.
The error makes me wonder if it is expecting an address in the source for the sender link. You could try explicitly adding both source (which shouldn't be necessary) and target:
diff --git a/examples/client.js b/examples/client.js
index 6f17ba3..b3378b4 100644
--- a/examples/client.js
+++ b/examples/client.js
@@ -36,7 +36,7 @@ function next_request(context) {
}
container.on('connection_open', function (context) {
- sender = context.connection.open_sender(args.node);
+ sender = context.connection.open_sender({source:'foo', target:args.node});
context.connection.open_receiver({source:{dynamic:true}});
});
container.on('receiver_open', function (context) {
If that doesn't help, the only other thing I could suggest is checking that the 'node' you are using i.e. value for -n/--node which is 'examples' by default, matches the name of an exchange (or possibly a queue)
My bad, I was confused by something. The problem is not with that specific line but with the next one.
Here is my journey and notes so far in case you are interested:
The connection is closed, there is an internal error in rabbitmq logs: {{symbol,<<"amqp:internal-error">>},"Session error: ~p~n~p~n",
.
This happens in the examples where we open_receiver
and use the context.connection.send to reply, which creates a default sender.
I think this one is easy to fix, looking at the README for the AMQP1.0 plugin it seems I should open the sender to /queue
:
"/queue" Publish to default exchange with message subj as routing key
The error is Attach rejected: {address_not_utf8_string,undefined}
.
I don't know much about AMQP1.0 nor rabbit's implementation. But for instance, if I could use the pseudo-queue amq.rabbitmq.reply-to (more about this at the bottom), I think the broker will push the message to the client without subscribing. This is the behavior I observed in the their STOMP implementation.
Fails with Error: Dynamic sources not supported
.
https://github.com/rabbitmq/rabbitmq-amqp1.0/issues/40 https://github.com/rabbitmq/rabbitmq-amqp1.0/issues/7
At this point I wondered how could I configure a dynamic reply-to queue for the responses. I couldn't set the auto-delete of AMQP 0.9.1 either, it seems is hardcoded: https://github.com/rabbitmq/rabbitmq-amqp1.0/blob/5e7b8178d25151f0cf3e3fe87eacf8c70af581ad/src/rabbit_amqp1_0_outgoing_link.erl#L161
I tried using an special pseudo-queue from rabbitmq called "amq.rabbitmq.reply-to" https://www.rabbitmq.com/direct-reply-to.html
The error is:
operation basic.consume caused a channel exception precondition_failed: reply consumer cannot acknowledge
I tried with different combinations of autoaccept
and rcv_settle_mode
, but couldn't make it work.
Sending without a target is done in e.g. the server.js example as it then uses the 'to' field of the message to indicate the recipient (taking that address from the reply-to in the request). That saves having to open a separate link for each response. It is an extension however (though I believe a widely supported one).
A receiver without a source only makes sense against a broker if dynamic is set to true. The fact that dynamic sources are not supported may therefore explain both errors.
Perhaps you could create the receiver for responses using source /topic/
I am doing this
then I try
examples/client.js
with an slight modification in the last line:and I get this:
In rabbitmq logs:
It seems to me that when this library open the sender it send something different than what rabbitmq expects for the SOURCE field. I don't understand much about AMQP.