5
votes

I hope someone can help me with this issue. I am using the Websocket support of Spring with SockJs and StompJs. I subscribed to 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 it's not declared as an auto delete queue, but this is what I want. Otherwise, I have 10k unused queues. In that moment where the queue has no consumer, the queue should be deleted. How can I assume this?

1
Looks like some library-specific problem, what did official docs says about cleaning up temporary queues? - pinepain
the only thing that i found was: "For example RabbitMQ creates auto-delete queue with destinations like '/exchange/amq.direct/a'" but then there is no user specific sending possible - Ogniute

1 Answers

4
votes

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