Example usage for org.springframework.amqp.rabbit.config RabbitListenerConfigUtils RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME

List of usage examples for org.springframework.amqp.rabbit.config RabbitListenerConfigUtils RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME

Introduction

In this page you can find the example usage for org.springframework.amqp.rabbit.config RabbitListenerConfigUtils RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME.

Prototype

String RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME

To view the source code for org.springframework.amqp.rabbit.config RabbitListenerConfigUtils RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME.

Click Source Link

Document

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

Usage

From source file:org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor.java

@Override
public void afterSingletonsInstantiated() {
    this.registrar.setBeanFactory(this.beanFactory);

    if (this.beanFactory instanceof ListableBeanFactory) {
        Map<String, RabbitListenerConfigurer> instances = ((ListableBeanFactory) this.beanFactory)
                .getBeansOfType(RabbitListenerConfigurer.class);
        for (RabbitListenerConfigurer configurer : instances.values()) {
            configurer.configureRabbitListeners(this.registrar);
        }// w  w w. j  ava  2 s . c om
    }

    if (this.registrar.getEndpointRegistry() == null) {
        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(
                    RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME,
                    RabbitListenerEndpointRegistry.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();
}