我使用 RabbitMQ 作为 Spring Websocket 应用程序的 Stomp 代理。客户端使用SockJS库连接到websocket接口(interface)。 Spring 在 RabbitMQ 上创建的每个队列都是持久的,而主题是非持久的。有什么方法可以使队列不持久吗? 我认为我无法在应用程序端进行配置。我玩了一下 RabbitMQ 配置,但也无法设置它。
RabbitMQ 上用于订阅和发送的示例目的地:
服务-用户-_385b304f-7a8f-4cf4-a0f1-d6ceed6b8c92
最佳答案
根据 RabbitMQ issues - https://github.com/rabbitmq/rabbitmq-stomp/issues/24#issuecomment-137896165 中的评论,从 RabbitMQ 3.6.0 开始可以指定端点的属性。 :
as of 3.6.0, it will be possible to explicitly define properties for endpoints such as /topic/ and /queue using subscription headers: durable, auto-delete, and exclusive, respectively.
作为解决方法,您可以尝试使用 AMQP 协议(protocol)自己创建队列,然后从 STOMP 协议(protocol)引用该队列。
关于rabbitmq - Spring+RabbitMQ 使队列不持久,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32986713/