I am new to Spring Framework and my questions are below:
I want to programmatically create the DefaultMessageListenerContainer program code, and the code that I use:
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer(); container.setConnectionFactory(cf); container.setDestination(Queue); container.setMessageListener(Consumer); container.setReceiveTimeout(-1); container.setMaxConcurrentConsumers(15); container.setConcurrentConsumers(10); container.start();
Why do I have to manually disable DefaultMessageListenerContainer when my project is not deployed? If I do not manually close the container, users remain open in my queues.
When I try to manually close the container (by calling container.shutdown() ), the procedure ends and the project does not continue. If I initialize the receiveTimeout without providing receiveTimeout , the shutdown procedure is executed correctly. Is there a problem with setReceiveTimeout(-1) ?
source share