I made some comments on
rabbitmq-stomp#24, but it was rightfully suggested to be more clear and complete here on the list.
We have a use case today in which everyone is connecting via AMQP, but we want to allow end users with more rigid firewall rules (e.g., only able to make outbound https connections on port 443) to use our service as well. We'd like to do that using the rabbitmq-web-stomp plugin and the /stomp/websocket endpoint.
Today we partition users with rabbitmq permissions such that they can read from exchanges and queues that begin with their username followed by a delimiter; for example, "enduser$
exchange.name." This works well with AMQP. (We didn't use vhosting because we needed one 'super' account to be able to easily read and write anything for any username.)
For each end user, we have a pre-declared exchange that we know will always exist for them, "username$listener". To this we bind predictably-named queues using routing keys. (A nice capability of doing it this way is that if the end user needs to add capacity to their ability to handle incoming messages, they can add more instances binding to the same predictably-named queues.) These queues are auto-delete, non-exclusive queues that we use only so long as something is connected and working. We'd prefer not to pre-declare the queues, as we'd rather drop the messages on the floor if nothing is there to listen.
It looks like subscribing to /exchange/exchange-name/routing-key would almost give us what we want; however, this auto-generates a queue name in the typical amq.* format; because of our permissions scheme, the web-stomp client is then not able to read from this autogenerated queue. I'd rather avoid modifying our permissions scheme to permit users to read from all temporary queues, and in general, I prefer to explicitly name queues so I can tell from the Admin plugin what a queue is for and where it's going at a glance.
One potential way this problem could be solved is allowing some x-header on the SUBSCRIBE message to specify a queue name when subscribing to an exchange with a routing key. We already know what we want the queue name to be on our end (because we already do it this way in the AMQP case). But we'd also need to potentially allow multiple endpoints to be able to subscribe to this same queue name-- we'd also need to be able to specify that it shouldn't be an exclusive queue.
Maybe if we could do something like "X-queue-name: temporary-queue-name" and "X-queue-exclusive: false" we could duplicate the behavior of the way we use AMQP today, but I'm certainly open to other ideas as well.
It might also work to look at the problem from the other direction and subscribe to /queue/queue-name, but be able to specify "X-exchange-name" and "X-routing-key" for the subscription instead of the default exchange with the queue name as the routing key.
Also a question that isn't entirely clear to me from looking at the docs for rabbitmq-stomp: there's a /amq/queue endpoint for accessing pre-declared queues that are managed by AMQP, and we can use that very nicely if we are in a position to create queues on the AMQP side. Does the /exchange/exchange-name endpoint "see" messages from the AMQP side of things too, or do exchanges and queues handled by rabbitmq-stomp exist in an isolated universe from the rest of AMQP?
Thanks for any input, ideas, and suggestions!
Nick