Home > Software engineering >  Having zero queues for a listening container in Spring boot AMQP
Having zero queues for a listening container in Spring boot AMQP

Time:11-29

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?

CodePudding user response:

That documentation is out of date; you can now start a container without any queues.

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

  • Related