Websockets,SockJs,Stomp,Spring,RabbitMQ,自动删除特定于用户的队列 [英] Websockets, SockJs, Stomp, Spring, RabbitMQ, delete User specific Queues automatically
问题描述
我希望有人可以帮助我解决这个问题:我使用Spring的Websocket支持.通过SockJs和StompJs,我订阅了一个队列,如下所示:
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) {
});
这对于Spring的SimpMessageSendingOperations确实很好用.但是有一个大问题.队列名称如下所示: gotMessage-user3w4tstcj ,它没有声明为自动删除队列,但这就是我想要的.否则,我有10k的未使用队列.在队列没有使用者的那一刻,应该删除该队列.我怎么能假设呢?
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?
推荐答案
存在相同的问题:
RabbitMQ在目的地之类的地方创建自动删除队列 使用/exchange/amq.direct/position-updates.所以在那种情况下 客户可以订阅/user/exchange/amq.direct/position-updates
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
请记住在脚踏代理中继配置中添加"/exchange/
"作为目标前缀
remember to add '/exchange/
' as a destination prefix in stomp broker relay configuration
这篇关于Websockets,SockJs,Stomp,Spring,RabbitMQ,自动删除特定于用户的队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!