Websockets, SockJs, Stomp, Spring, RabbitMQ, delete User specific Queues automatically(Websockets、SockJs、Stomp、Spring、RabbitMQ,自动删除用户特定队列)
问题描述
我希望有人可以帮助我解决这个问题.我正在使用带有 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,自动删除用户特定队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Websockets、SockJs、Stomp、Spring、RabbitMQ,自动删除用
基础教程推荐
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01