Example usage for org.springframework.jms.config JmsListenerConfigUtils JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME

List of usage examples for org.springframework.jms.config JmsListenerConfigUtils JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME

Introduction

In this page you can find the example usage for org.springframework.jms.config JmsListenerConfigUtils JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME.

Prototype

String JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME

To view the source code for org.springframework.jms.config JmsListenerConfigUtils JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME.

Click Source Link

Document

The bean name of the internally managed JMS listener endpoint registry.

Usage

From source file:org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor.java

@Override
public void afterSingletonsInstantiated() {
    // Remove resolved singleton classes from cache
    this.nonAnnotatedClasses.clear();

    if (this.beanFactory instanceof ListableBeanFactory) {
        // Apply JmsListenerConfigurer beans from the BeanFactory, if any
        Map<String, JmsListenerConfigurer> beans = ((ListableBeanFactory) this.beanFactory)
                .getBeansOfType(JmsListenerConfigurer.class);
        List<JmsListenerConfigurer> configurers = new ArrayList<>(beans.values());
        AnnotationAwareOrderComparator.sort(configurers);
        for (JmsListenerConfigurer configurer : configurers) {
            configurer.configureJmsListeners(this.registrar);
        }/*  w  w w. j  a va  2  s .co m*/
    }

    if (this.registrar.getEndpointRegistry() == null) {
        // Determine JmsListenerEndpointRegistry bean from the BeanFactory
        if (this.endpointRegistry == null) {
            Assert.state(this.beanFactory != null,
                    "BeanFactory must be set to find endpoint registry by bean name");
            this.endpointRegistry = this.beanFactory.getBean(
                    JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME,
                    JmsListenerEndpointRegistry.class);
        }
        this.registrar.setEndpointRegistry(this.endpointRegistry);
    }

    if (this.containerFactoryBeanName != null) {
        this.registrar.setContainerFactoryBeanName(this.containerFactoryBeanName);
    }

    // Set the custom handler method factory once resolved by the configurer
    MessageHandlerMethodFactory handlerMethodFactory = this.registrar.getMessageHandlerMethodFactory();
    if (handlerMethodFactory != null) {
        this.messageHandlerMethodFactory.setMessageHandlerMethodFactory(handlerMethodFactory);
    }

    // Actually register all listeners
    this.registrar.afterPropertiesSet();
}