Websockets, SockJs, Stomp, Spring, RabbitMQ, delete User specific Queues automatically

耗尽温柔 提交于 2019-12-04 13:36:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!