我希望有人可以帮助我解决这个问题.我正在使用带有 SockJs 和 StompJs 的 Spring 的 Websocket 支持.我订阅了这样的队列:
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) {
});
这对 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 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?
有同样的问题,来自文档:
had same problem, from the documentation:
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
记得在 stomp 代理中继配置中添加/exchange/
"作为目标前缀
remember to add '/exchange/
' as a destination prefix in stomp broker relay configuration
这篇关于Websockets、SockJs、Stomp、Spring、RabbitMQ,自动删除用户特定队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!