Closed yjh0502 closed 6 years ago
Last time that function was changed was 6 years ago. It's something we'd have to discuss on our team. What's the use case?
rabbitmq-stomp
relies on rabbit_routing_util:parse_endpoint/1
for routing. As a result there's no way to send message to default exchange with stomp
plugin. The problem can be fixed by either client side or plugin side. I think fixing it on client side is better because empty exchange name is actually valid.
@yjh0502 to send messages to default exchange, you should use the /queue/<queuename>
destination as stated in the stomp plugin docs: https://www.rabbitmq.com/stomp.html
This is a special case designed for default exchange.
The default exchange does not work as other exchanges and routes to queues directly, that may be the reason it was designed like this.
I think the reason is a lot more boring: it's pretty confusing to use an empty string as a target in a URI, so /queue/{name}
was used instead. In some other cases (CLI) we use amq.default
. So I think given the use case the answer here is "we should not allow empty exchange names". Thank you for bringing this up, though :)
We cannot use /queue/queue-name
for multiple-producer single-exclusive consumer scenario. If a consumer binds the queue with exclusive option, producers cannot push messages on the same queue.
Exclusive queues are not meant to have well-known names. Use /amq/queue
or a topic. This is quickly becoming mailing list material.
Thanks for the comment!
It seems that
rabbit_routing_util:parse_endpoint/1
disallow exchange with empty name. Could we change it as empty exchange name refers to default exchange?https://github.com/rabbitmq/rabbitmq-erlang-client/blob/d776a98fbba46a27869ed9ef8424b4e504b5b03c/src/rabbit_routing_util.erl#L65-L66