Class RabbitListenerEndpointRegistrar

java.lang.Object
org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

public class RabbitListenerEndpointRegistrar extends Object implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean
Helper bean for registering RabbitListenerEndpoint with a RabbitListenerEndpointRegistry.
Since:
1.4
See Also:
  • Constructor Details

    • RabbitListenerEndpointRegistrar

      public RabbitListenerEndpointRegistrar()
  • Method Details

    • setEndpointRegistry

      public void setEndpointRegistry(RabbitListenerEndpointRegistry endpointRegistry)
      Set the RabbitListenerEndpointRegistry instance to use.
      Parameters:
      endpointRegistry - the RabbitListenerEndpointRegistry instance to use.
    • getEndpointRegistry

      public @Nullable RabbitListenerEndpointRegistry getEndpointRegistry()
      Returns:
      the RabbitListenerEndpointRegistry instance for this registrar, may be null.
    • getCustomMethodArgumentResolvers

      public List<org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver> getCustomMethodArgumentResolvers()
      Return the list of HandlerMethodArgumentResolver.
      Returns:
      the list of HandlerMethodArgumentResolver.
      Since:
      2.3.7
    • setCustomMethodArgumentResolvers

      public void setCustomMethodArgumentResolvers(org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver... methodArgumentResolvers)
      Add custom methods arguments resolvers to RabbitListenerAnnotationBeanPostProcessor Default empty list.
      Parameters:
      methodArgumentResolvers - the methodArgumentResolvers to assign.
      Since:
      2.3.7
    • setMessageHandlerMethodFactory

      public void setMessageHandlerMethodFactory(org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory rabbitHandlerMethodFactory)
      Set the MessageHandlerMethodFactory to use to configure the message listener responsible to serve an endpoint detected by this processor.

      By default, DefaultMessageHandlerMethodFactory is used, and it can be configured further to support additional method arguments or to customize conversion and validation support. See DefaultMessageHandlerMethodFactory javadoc for more details.

      Parameters:
      rabbitHandlerMethodFactory - the MessageHandlerMethodFactory instance.
    • getMessageHandlerMethodFactory

      public @Nullable org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory getMessageHandlerMethodFactory()
      Returns:
      the custom MessageHandlerMethodFactory to use, if any.
    • setContainerFactory

      public void setContainerFactory(RabbitListenerContainerFactory<?> containerFactory)
      Set the RabbitListenerContainerFactory to use in case a RabbitListenerEndpoint is registered with a null container factory.

      Alternatively, the bean name of the RabbitListenerContainerFactory to use can be specified for a lazy lookup, see setContainerFactoryBeanName(String).

      Parameters:
      containerFactory - the RabbitListenerContainerFactory instance.
    • setContainerFactoryBeanName

      public void setContainerFactoryBeanName(String containerFactoryBeanName)
      Set the bean name of the RabbitListenerContainerFactory to use in case a RabbitListenerEndpoint is registered with a null container factory. Alternatively, the container factory instance can be registered directly: see setContainerFactory(RabbitListenerContainerFactory).
      Parameters:
      containerFactoryBeanName - the RabbitListenerContainerFactory bean name.
      See Also:
    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
      A BeanFactory only needs to be available in conjunction with setContainerFactoryBeanName(String).
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Parameters:
      beanFactory - the BeanFactory instance.
    • getValidator

      public @Nullable org.springframework.validation.Validator getValidator()
      Get the validator, if supplied.
      Returns:
      the validator.
      Since:
      2.3.7
    • setValidator

      public void setValidator(org.springframework.validation.Validator validator)
      Set the validator to use if the default message handler factory is used.
      Parameters:
      validator - the validator.
      Since:
      2.3.7
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • registerAllEndpoints

      protected void registerAllEndpoints()
    • registerEndpoint

      public void registerEndpoint(RabbitListenerEndpoint endpoint, @Nullable RabbitListenerContainerFactory<?> factory)
      Register a new RabbitListenerEndpoint alongside the RabbitListenerContainerFactory to use to create the underlying container.

      The factory may be null if the default factory has to be used for that endpoint.

      Parameters:
      endpoint - the RabbitListenerEndpoint instance to register.
      factory - the RabbitListenerContainerFactory to use.
    • registerEndpoint

      public void registerEndpoint(RabbitListenerEndpoint endpoint)
      Register a new RabbitListenerEndpoint using the default RabbitListenerContainerFactory to create the underlying container.
      Parameters:
      endpoint - the RabbitListenerEndpoint instance to register.
      See Also: