RabbitMQ + STOMP - can I create durable queue on subscribe?

2.8k Views Asked by At

Can I make RabbitMQ 3.4.1 create new DURABLE queue named "q123" when a STOMP client sends

SUBSCRIBE
destination: /amq/queue/q123
...

and use this queue for later subscriptions ?

1

There are 1 best solutions below

0
pinepain On

You can't create new queue outside STOMP gateway. You can SEND and SUBSCRIBE them, but not create new one.

STOMP may create it for you if you will refer to /queue/<your-queue-name> in vhost specified by your STOMP plugin settings (by default it is standard / vhost).

So such STOMP frame will create new-random-one durable queue in / vhost.

SUBSCRIBE
destination: /queue/new-random-one

Here is how to run it over raw shell (^@ stands for Ctrl+@, empty line before it matters):

nc localhost 61613
CONNECT

^@
CONNECTED
session:session-3IE6yYjn6borQ_4KLfxLMw
heart-beat:0,0
server:RabbitMQ/3.4.1
version:1.0

SUBSCRIBE
destination: /queue/new-random-one

^@
DISCONNECT

^@

So after that, even after disconnected, you'll see that new-random-one queue will still reside in default vhost.

For more, read details on Destinations section of RabbitMQ STOMP Adapter manual page.