However I'm expecting the recovery settings to be considered from connection factory and use recovery attempts to be for 10times
Both attributes are not part of the ConnectionFactory
contract so there is no way for DefaultMessageListenerContainer
to figure that out.
You can rewrite your config as follows to use a 10 sec recovery interval:
<jms:listener-container connection-factory="connectionFactory"
concurrency="1" recovery-interval="10000">
<jms:listener destination="kpQueue" ref="kpJmsDelegator"
method="onMessage" />
</jms:listener-container>
There is no way to limit the number of recoveries but it should be fairly easy for you to extend from DefaultMessageListenerContainer
and create your own extension of recoverAfterListenerSetupFailure
. You could retry a number of times and if that's not working, you could call stop
on the container to stop listening on that queue. That means that if the broker is failing and resume after 20 min or so, your listener won't be enabled anymore...