简体   繁体   English

Websockets, SockJs, Stomp, Spring, RabbitMQ, 自动删除用户特定的队列

[英]Websockets, SockJs, Stomp, Spring, RabbitMQ, delete User specific Queues automatically

I hope someone can help me with this issue.我希望有人能帮助我解决这个问题。 I am using the Websocket support of Spring with SockJs and StompJs.我正在将 Spring 的 Websocket 支持与 SockJs 和 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.这对于 Spring 的 SimpMessageSendingOperations 非常有效。 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.队列名称如下所示: gotMessage-user3w4tstcj并且它没有声明为自动删除队列,但这正是我想要的。 Otherwise, I have 10k unused queues.否则,我有 10k 个未使用的队列。 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 creates auto-delete queues when destinations like /exchange/amq.direct/position-updates are used.当使用像 /exchange/amq.direct/position-updates 这样的目的地时,RabbitMQ 会创建自动删除队列。 So in that case the client could subscribe to /user/exchange/amq.direct/position-updates所以在这种情况下,客户端可以订阅 /user/exchange/amq.direct/position-updates

remember to add ' /exchange/ ' as a destination prefix in stomp broker relay configuration记得在 stomp broker 中继配置中添加“ /exchange/ ”作为目标前缀

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Magnolia CMS 上使用 Spring + SockJS + STOMP 的 Websockets - Websockets Using Spring + SockJS + STOMP on Magnolia CMS 在SockJS和Tomcat上使用STOMP的Spring无法升级到Websockets - Spring with STOMP over SockJS and Tomcat not upgrading to Websockets 使用Spring Rabbitmq Stomp的持久队列 - Durable queues using Spring Rabbitmq Stomp 通过spring websocket,sockJs和STOMP向经过身份验证的用户发送通知 - Send notification to authenticated user over spring websocket, sockJs and STOMP 带有STOMP,SOCKJS和ACTIVEMQ的Spring WebSocket - Spring websocket with STOMP, SOCKJS and ACTIVEMQ 通过基于令牌的身份验证(JWT)使用Spring Websockets(sockJS + Stomp)的最佳方法 - Best approach to use Spring websockets (sockJS + Stomp) with token based authentication (JWT) 尝试连接 websocket 时 Websockets 使用“SockJS+spring websocket”错误(404:找不到 STOMP 端点的路径) - Websockets using "SockJS+spring websocket" error when trying to connect the websocket (404: path of STOMP endpoint not found) WebSocket与Sockjs和Spring 4但没有Stomp - WebSocket with Sockjs & Spring 4 but without Stomp Spring 4 STOMP Websockets Heartbeat - Spring 4 STOMP Websockets Heartbeat 在使用 Spring Boot 和 STOMP 时,有没有办法让队列不删除消息? - When using Spring Boot and STOMP, is there a way to make queues not delete messages?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM