简体   繁体   中英

Having zero queues for a listening container in Spring boot AMQP

I'm setting up an spring boot application which supports websockets and AMQP. 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.

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. I start the container immidiate upon connection.

What troubles me is that in the Spring AMQP documentation, it states that

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. Also, the client may want to unsubscribe to all it's subscriptions which also leads to 0 queues in total and this is disallowed.

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? 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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