简体   繁体   English

在 Spring 引导 AMQP 中,侦听容器的队列为零

[英]Having zero queues for a listening container in Spring boot AMQP

I'm setting up an spring boot application which supports websockets and AMQP.我正在设置一个支持 websockets 和 AMQP 的 spring 启动应用程序。 Whenever a client opens a websocket connection to my spring boot application, the client should be allowed to subscribe for events or send messages through the websocket connection much like what the STOMP protocol already offers.每当客户端打开到我的 spring 启动应用程序的 websocket 连接时,应该允许客户端订阅事件或通过 websocket 连接发送消息,就像 STOMP 协议已经提供的一样。

I'm planning to implement the architecture as following:我计划实现如下架构:

  • Whenever a new client connects, I instantiate a DirectMessageListenerContainer which is unique for this client socket connection.每当新客户端连接时,我都会实例化一个 DirectMessageListenerContainer,它对于此客户端套接字连接是唯一的。 I start the container immidiate upon connection.我在连接后立即启动容器。

What troubles me is that in the Spring AMQP documentation, it states that令我困扰的是,在 Spring AMQP 文档中,它指出

The container must be configured to listen on at least one queue容器必须配置为监听至少一个队列

This is not the case whenever a client connects, it will have 0 queues upon connection.每当客户端连接时情况并非如此,连接时它将有 0 个队列。 Also, the client may want to unsubscribe to all it's subscriptions which also leads to 0 queues in total and this is disallowed.此外,客户端可能想要取消订阅它的所有订阅,这也会导致总共 0 个队列,这是不允许的。

Will I have to set a condition that if client has 0 subscriptions, I stop the container & if there's > 0 queues, I start the container again?我是否必须设置一个条件,如果客户端有 0 个订阅,我会停止容器,如果有 > 0 个队列,我会再次启动容器? Or is my architecture fundementaly wrong?还是我的架构根本错了?

That documentation is out of date;该文档已过时; you can now start a container without any queues.您现在可以在没有任何队列的情况下启动容器。

https://github.com/spring-projects/spring-amqp/issues/1541 https://github.com/spring-projects/spring-amqp/issues/1541

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM