问题
i hope someone can help me with this issue: I use the Websocket support of Spring. With SockJs and StompJs i subscribe a queue like this:
var socket = new SockJS(localhost + 'websocket');
stompClient = Stomp.over(socket);
stompClient.connect('', '', function(frame) {
stompClient.subscribe("/user/queue/gotMessage", function(message) {
gotMessage((JSON.parse(message.body)));
});
}, function(error) {
});
This works really fine with the SimpMessageSendingOperations of Spring. BUT there is one big problem. the Queue name looks like this: gotMessage-user3w4tstcj and its not declared as an auto delete queue, but this is what i want. Otherwise i have 10k of unused queues. In that moment where the queue as no consumer, the queue should be deleted. How can i assume this?
回答1:
had same problem, from the documentation:
RabbitMQ creates auto-delete queues when destinations like /exchange/amq.direct/position-updates are used. So in that case the client could subscribe to /user/exchange/amq.direct/position-updates
remember to add '/exchange/
' as a destination prefix in stomp broker relay configuration
来源:https://stackoverflow.com/questions/25018814/websockets-sockjs-stomp-spring-rabbitmq-delete-user-specific-queues-automat