Package com.ibm.mq.spring.boot
Class MQConfigurationListenerDefault
java.lang.Object
com.ibm.mq.spring.boot.MQConfigurationListenerDefault
- All Implemented Interfaces:
EventListener,org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent>
@ConditionalOnClass({org.springframework.boot.autoconfigure.jms.JmsProperties.Listener.class,org.springframework.jms.annotation.JmsListener.class})
@ConditionalOnMissingBean(org.springframework.jms.annotation.JmsListener.class)
public class MQConfigurationListenerDefault
extends Object
implements org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent>
The default Spring configuration for a JMS Listener sets the receive timeout (a polling
loop timer) too low for a cost-effective solution with IBM MQ.
See this article
for more information.
This class will override that default value if it is not explicitly set in the application
properties. The application still has control though. If the app sets the value
via a call to the listener.setReceiveTimeout method, then that still will be honoured as it comes
after the creation and initial attribute setting of the listener object.
This method is invoked early in the cycle, once the application environment has been loaded. We then
get the opportunity to inspect and add to the environment that will be used later on by the
JMS Listener initialisers.
This allows the MQ JMS listener to have a different effective default than other JMS providers.
Support for this property within Spring Boot itself was added in version 2.2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonApplicationEvent(org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent event) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
MQConfigurationListenerDefault
public MQConfigurationListenerDefault()
-
-
Method Details
-
onApplicationEvent
@Bean @Lazy(false) public void onApplicationEvent(org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent>
-