protected void processAmqpListener(
     RabbitListener rabbitListener, Method method, Object bean, String beanName) {
   Method methodToUse = checkProxy(method, bean);
   MethodRabbitListenerEndpoint endpoint = new MethodRabbitListenerEndpoint();
   endpoint.setMethod(methodToUse);
   endpoint.setBeanFactory(this.beanFactory);
   processListener(endpoint, rabbitListener, bean, methodToUse, beanName);
 }
  private void processListener(
      MethodRabbitListenerEndpoint endpoint,
      RabbitListener rabbitListener,
      Object bean,
      Object adminTarget,
      String beanName) {
    endpoint.setBean(bean);
    endpoint.setMessageHandlerMethodFactory(this.messageHandlerMethodFactory);
    endpoint.setId(getEndpointId(rabbitListener));
    endpoint.setQueueNames(resolveQueues(rabbitListener));

    endpoint.setExclusive(rabbitListener.exclusive());
    String priority = resolve(rabbitListener.priority());
    if (StringUtils.hasText(priority)) {
      try {
        endpoint.setPriority(Integer.valueOf(priority));
      } catch (NumberFormatException ex) {
        throw new BeanInitializationException(
            "Invalid priority value for " + rabbitListener + " (must be an integer)", ex);
      }
    }

    String rabbitAdmin = resolve(rabbitListener.admin());
    if (StringUtils.hasText(rabbitAdmin)) {
      Assert.state(
          this.beanFactory != null, "BeanFactory must be set to resolve RabbitAdmin by bean name");
      try {
        endpoint.setAdmin(this.beanFactory.getBean(rabbitAdmin, RabbitAdmin.class));
      } catch (NoSuchBeanDefinitionException ex) {
        throw new BeanInitializationException(
            "Could not register rabbit listener endpoint on ["
                + adminTarget
                + "], no "
                + RabbitAdmin.class.getSimpleName()
                + " with id '"
                + rabbitAdmin
                + "' was found in the application context",
            ex);
      }
    }

    RabbitListenerContainerFactory<?> factory = null;
    String containerFactoryBeanName = resolve(rabbitListener.containerFactory());
    if (StringUtils.hasText(containerFactoryBeanName)) {
      Assert.state(
          this.beanFactory != null,
          "BeanFactory must be set to obtain container factory by bean name");
      try {
        factory =
            this.beanFactory.getBean(
                containerFactoryBeanName, RabbitListenerContainerFactory.class);
      } catch (NoSuchBeanDefinitionException ex) {
        throw new BeanInitializationException(
            "Could not register rabbit listener endpoint on ["
                + adminTarget
                + "] for bean "
                + beanName
                + ", no "
                + RabbitListenerContainerFactory.class.getSimpleName()
                + " with id '"
                + containerFactoryBeanName
                + "' was found in the application context",
            ex);
      }
    }

    this.registrar.registerEndpoint(endpoint, factory);
  }