``++DefaultMessageListenerContainer++`` is implemented as a JMS poller. While the Spring container is shutting itself down, as each in-progress JMS ``++Consumer.receive()++`` call completes, any non-``++null++`` return value will be a JMS message that the DMLC will _discard_ due to the shutdown in progress. That will result in the received message never being processed. 


To prevent message loss during restart operations, set ``++acceptMessagesWhileStopping++`` to ``++true++`` so that such messages will be processed before shut down.


== Noncompliant Code Example

----
<bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">  <!-- Noncompliant -->
   <property name="connectionFactory" ref="connFactory" />
   <property name="destination" ref="dest" />
   <property name="messageListener" ref="serviceAdapter" />
   <property name="autoStartup" value="true" />
   <property name="concurrentConsumers" value="10" />
   <property name="maxConcurrentConsumers" value="10" />
   <property name="clientId" value="myClientID" />
</bean>
----


== Compliant Solution

----
<bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
   <property name="connectionFactory" ref="connFactory" />
   <property name="destination" ref="dest" />
   <property name="messageListener" ref="serviceAdapter" />
   <property name="autoStartup" value="true" />
   <property name="concurrentConsumers" value="10" />
   <property name="maxConcurrentConsumers" value="10" />
   <property name="clientId" value="myClientID" />
   <property name="acceptMessagesWhileStopping" value="true" />
</bean>
----


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
