Access /queue or /topic created via STOMP over AMQP
I have a scenario where clients post messages via STOMP to a RabbitMQ /queue
or /topic
destination.
On the other side i have a server process which connects to RabbitMQ via AMQP. Is it possible to access the "STOMP-channels" from AMQP or are they isolated into their own name space?
it looks like AMQP channels can be accessed from STOMP via /amq/queue/
but i did not find a case for the other direction.
I found the answer by using the Rabbit web admin and taking a closer look at what the Spring-Stomp over Websocket implementation actually does in the background.
The /topic
namespace is implemented by registering an auto-delete queue per connected stomp client which uses a routing key of the topic name on the amq.topic
exchange. So to listen to these messages from a non Stomp client you would have to do the same.
The /queue
namespace is implemented by creating a (durable) queue and registering a binding form the default empty "" exchange to the queue. To consume messages you can directly consume the queue - and to sent messages to the queue you would send a message to the empty exchange with the routing key set to the queue name.
上一篇: RabbitMq连接超时异常