Can I have multiple stomp subscriptions to one queue?

2,138 views
Skip to first unread message

Igor Drozdov

unread,
Nov 2, 2016, 8:16:03 PM11/2/16
to rabbitmq-users
Hi,

I have many websocket connections for receiving messages from rabbitmq.
Is it legal to have one queue for one websocket connection with multiple bindings to multiple exchanges?
I’d like to use stomp websocket connection to subscribe one user to one queue and have multiple bindings.
I subscribe user to exchange with header x-queue-name:my-queue, and all is ok - rabbitmq creates queue with binding and sending messages to it.
Then I make subscriptions multiple times to same queue and every time I can see new bindings and new messages.
But I have 2 problems:
1 - queue send to client random consumerTag when it receives message. So wrong callback fires for current message. I can decide this problem, but..
2 - I still receive message when stomp js client trigger unsubscribe method with same subscription id. (web interface still show me binding in my queue). 

So I have one question - can I have one queue for one websocket connection with multiple bindings to multiple exchanges with ability to remove these bindings when I call unsubscribe stomp method?


Thank you for your answer

Michael Klishin

unread,
Nov 2, 2016, 8:28:10 PM11/2/16
to rabbitm...@googlegroups.com
You can have multiple consumers with STOMP as long as you use the correct destination type
and subscription IDs are unique (they must be per STOMP spec).

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Igor Drozdov

unread,
Nov 6, 2016, 8:41:45 AM11/6/16
to rabbitmq-users
Michael, thank you for your answer!
I successfully created one queue with multiple bindings for one websocket connection and everything is ok
But when I unsubscribe one of them - my certain consumer removed, but binding for it still available in rabbitmq admin panel
Could you please explain me why? Can this behavior do any performance problems?

Thank you

Michael Klishin

unread,
Nov 6, 2016, 9:11:07 AM11/6/16
to rabbitm...@googlegroups.com, Igor Drozdov
STOMP and, by extension, Web STOMP has no the concept of bindings and therefore the plugin
should only delete queues when you unsubscribe. Which in turn removes all bindings of the
queue(s).

Leaking queues is something to be avoided (and to some extent an application
developer's responsibility) because each queue consumes a certain amount of RAM
even if it's empty (queues have state).
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send an email to rabbitm...@googlegroups.com.

Igor Drozdov

unread,
Nov 6, 2016, 9:54:28 AM11/6/16
to rabbitmq-users, unc...@gmail.com
Michael, thanks
I'm trying to understand the best way to handle thousands of messages with STOMP over websockets
Should it be one queue for subscription or it really ok use one queue with multiple consumers? Can't find answer.
Now I am using one queue with multiple consumers.
All my queues declared with auto-delete and exclusive flag, so cluster of 4 nodes with 16gb RAM is ok, only 1.7gb RAM used in each of them
So when I have 10k connections - 10k queues - 20k consumers - all nodes params looks good
Sometimes only count of queued messages (Number of messages that are available to be delivered now) grows. 
Message rate is around 500/s publish and 1000k/s deliver (no more then 1.5k)
Maybe prefetchCount can help me, I should read more about it, not it have default value - 1k
Could you please give me any advise about high message rate? What the best strategy for one websocket and multiple subscriptions?

Thank you for your help


воскресенье, 6 ноября 2016 г., 17:11:07 UTC+3 пользователь Michael Klishin написал:

Michael Klishin

unread,
Nov 6, 2016, 9:56:11 AM11/6/16
to rabbitm...@googlegroups.com, Igor Drozdov
Please start new threads for new questions. 

Igor Drozdov

unread,
Nov 6, 2016, 9:57:21 AM11/6/16
to rabbitmq-users, unc...@gmail.com
Thanks

воскресенье, 6 ноября 2016 г., 17:56:11 UTC+3 пользователь Michael Klishin написал:
Reply all
Reply to author
Forward
0 new messages