title: Disabling the listening to rabbit queues from spring application.properties
body: <p>I want to create an application-development.properties file in spring to define a dev environment. In this environment want to disable the listening to the rabbit queues because I don't want to interfere with the staging queues while debugging etc. </p>
  
  <p>Problem is - I can't find a property that controls this. No "active" property or "enabled" property or anything..</p>
  
  <p>These are the properties I found in the <a href="http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/common-application-properties.html" rel="noreferrer">Spring docs</a>:</p>
  
  <pre><code># RABBIT (RabbitProperties)
  spring.rabbitmq.addresses= # connection addresses (e.g. myhost:9999,otherhost:1111)
  spring.rabbitmq.dynamic=true # create an AmqpAdmin bean
  spring.rabbitmq.host= # connection host
  spring.rabbitmq.port= # connection port
  spring.rabbitmq.password= # login password
  spring.rabbitmq.requested-heartbeat= # requested heartbeat timeout, in seconds; zero for none
  spring.rabbitmq.listener.acknowledge-mode= # acknowledge mode of container
  spring.rabbitmq.listener.concurrency= # minimum number of consumers
  spring.rabbitmq.listener.max-concurrency= # maximum number of consumers
  spring.rabbitmq.listener.prefetch= # number of messages to be handled in a single request
  spring.rabbitmq.listener.transaction-size= # number of messages to be processed in a transaction
  spring.rabbitmq.ssl.enabled=false # enable SSL support
  spring.rabbitmq.ssl.key-store= # path to the key store that holds the SSL certificate
  spring.rabbitmq.ssl.key-store-password= # password used to access the key store
  spring.rabbitmq.ssl.trust-store= # trust store that holds SSL certificates
  spring.rabbitmq.ssl.trust-store-password= # password used to access the trust store
  spring.rabbitmq.username= # login user
  spring.rabbitmq.virtual-host= # virtual host to use when connecting to the broker
  </code></pre>
  
  <p>I did find a way not to load the amqp-context.xml beans that contain the listener definitions by using <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html" rel="noreferrer">Spring profiles</a> and add <code>&lt;beans profile="development"&gt; .. &lt;/beans&gt;</code> to the xml but this is much less flexible as I have to define different profiles, and changing what they include involves changing the code.</p>
  
  <p><strong>EDIT</strong> this is how my amqp-context.xml looks like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:task="http://www.springframework.org/schema/task" 
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:rabbit="http://www.springframework.org/schema/rabbit"
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/task
          http://www.springframework.org/schema/task/spring-task-3.0.xsd
          http://www.springframework.org/schema/context 
          http://www.springframework.org/schema/context/spring-context.xsd
          http://www.springframework.org/schema/rabbit 
          http://www.springframework.org/schema/rabbit/spring-rabbit-1.3.xsd"&gt;
  
      &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="ignoreResourceNotFound" value="true" /&gt;
          &lt;property name="locations"&gt;
              &lt;list&gt;
                  &lt;value&gt;application.${env:xxxx}.properties&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;rabbit:connection-factory id="connectionFactory" host="${rabbit_host}"
          virtual-host="${rabbit_virtual_host}" username="${rabbit_username}" password="${rabbit_password}" port="${rabbit_port}"/&gt;   
  
      &lt;!-- Connection Factory --&gt;
      &lt;bean id="rabbitConnFactory"
          class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory"&gt;
      &lt;/bean&gt;
  
  
      &lt;!-- Spring AMQP Template --&gt;
      &lt;bean id="template" class="org.springframework.amqp.rabbit.core.RabbitTemplate"&gt;
          &lt;property name="connectionFactory" ref="connectionFactory" /&gt;
          &lt;property name="routingKey" value="${my_queue}" /&gt;
          &lt;property name="queue" value="${my_queue}" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Spring AMQP Admin --&gt;
      &lt;bean id="admin" class="org.springframework.amqp.rabbit.core.RabbitAdmin"&gt;
          &lt;constructor-arg ref="rabbitConnFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;rabbit:listener-container connection-factory="connectionFactory" requeue-rejected="false" concurrency="10"&gt;
          &lt;rabbit:listener ref="ProcessMessage"
              queue-names="${queue_name}" /&gt;
      &lt;/rabbit:listener-container&gt; 
  
      &lt;bean id="ProcessStuff" class="Process" /&gt;
  
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Does anyone have an idea on how I can manage the listening to queues directly from the application.properties file? please?</p>