rabbitmq / rabbitmq-stomp

RabbitMQ STOMP plugin
https://www.rabbitmq.com/stomp.html
Other
49 stars 28 forks source link

Delete binding when unsubscribe from exclusive queue #99

Closed yurkovas closed 7 years ago

yurkovas commented 7 years ago

I use multiple subscriptions via one exclusive and auto delete queue. When do unsubscribe then stomp plugin delete consumer, but not delete binding. In this case stomp client will receive redundant data.

michaelklishin commented 7 years ago

Thank you for your time but this cannot be accepted as is and I don't understand the intent. Please add some integration tests, which should help with both concerns.

michaelklishin commented 7 years ago

Had a few unsubmitted comments sitting in the "review queue", sorry.

michaelklishin commented 7 years ago

I'm afraid our team still does not understand the intent here. Exclusive queues, when they are deleted, will see their bindings automatically removed. So we need a step-by-step way to reproduce the problem this is attempting to solve.

yurkovas commented 7 years ago

Michael, thank you.

Our problem described here.

On the website we use Spring WebSocket StompBrokerRelay. In process of migration from ajax to websocket + stomp our RabbitMQ cluster with 5 nodes start fail 1-2 times a week. The Stomp "subscribe" for each call creates a new queue, on several web pages this function called up to 10 times. So we decided to use single exclusive queue ("x-queue-name" header) for each distinct websocket connection: RabbitMQ start fail 2-3 times less. But, when call "unsubscribe" function - stomp plugin removes the consumer, but does not remove the binding. When this queue has other subscriptions then WebSocket client continue to receive the data on which it has already unsubscribed.

At this moment, we solved problem with fails RabbitMQ: use 2 clusters with 5 nodes in each. Also continue to use single queue for each distinct WebSocket connection. In one cluster we install stomp plugin with modifications from this pull request.

I cancel this pull request. These changes are only required for our case: when use multiple subscriptions through one queue. Also, i don't test how plugin will work with "Temp Queue".

Using Spring WebSocket StompBrokerRelay is not optimal, because with 10k connections and 20k consumers (10k online users) we have problems. For 100k online users we need lots of hardware for RabbitMQ, frontend servers will receive many data duplicates from backend servers for deliver it to each users.