2015-07-23 2 views
9

ich eine application-development.properties Datei im Frühjahr erstellen möchten ein Entwickler-Umgebung zu definieren. In dieser Umgebung möchten Sie das Abhören der Warteschlangen deaktivieren, da ich die Staging-Warteschlangen während des Debuggens usw. nicht stören möchte.das Hören auf Kaninchen-Warteschlangen aus Feder Deaktivieren application.properties

Problem ist - Ich kann keine Eigenschaft finden, die dies steuert. Nein „aktiv“ Eigenschaft oder „freigegeben“ Eigentum oder irgendetwas ..

Dies sind die Eigenschaften I in den Spring docs gefunden:

# 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 

ich einen Weg finden, nicht die AMQP-context.xml Bohnen zu laden dass die Zuhörer Definitionen enthalten, die von Spring profiles mit und <beans profile="development"> .. </beans> zum xml hinzufügen, aber das ist viel weniger flexibel als ich verschiedene Profile definieren müssen, und ändern, was sie beinhalten beinhaltet den Code zu ändern.

EDIT dies ist, wie mein AMQP-context.xml wie folgt aussieht:

<?xml version="1.0" encoding="UTF-8"?> 
<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"> 

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="ignoreResourceNotFound" value="true" /> 
     <property name="locations"> 
      <list> 
       <value>application.${env:xxxx}.properties</value> 
      </list> 
     </property> 
    </bean> 
    <rabbit:connection-factory id="connectionFactory" host="${rabbit_host}" 
     virtual-host="${rabbit_virtual_host}" username="${rabbit_username}" password="${rabbit_password}" port="${rabbit_port}"/> 

    <!-- Connection Factory --> 
    <bean id="rabbitConnFactory" 
     class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory"> 
    </bean> 


    <!-- Spring AMQP Template --> 
    <bean id="template" class="org.springframework.amqp.rabbit.core.RabbitTemplate"> 
     <property name="connectionFactory" ref="connectionFactory" /> 
     <property name="routingKey" value="${my_queue}" /> 
     <property name="queue" value="${my_queue}" /> 
    </bean> 

    <!-- Spring AMQP Admin --> 
    <bean id="admin" class="org.springframework.amqp.rabbit.core.RabbitAdmin"> 
     <constructor-arg ref="rabbitConnFactory" /> 
    </bean> 

    <rabbit:listener-container connection-factory="connectionFactory" requeue-rejected="false" concurrency="10"> 
     <rabbit:listener ref="ProcessMessage" 
      queue-names="${queue_name}" /> 
    </rabbit:listener-container> 

    <bean id="ProcessStuff" class="Process" /> 



</beans> 

Hat auf jemand eine Idee, wie ich das Hören auf Warteschlangen von den application.properties Datei direkt verwalten kann? Bitte?

+0

was hat Ihre AMQP-context.xml aussehen? – jst

+0

@jst Ich habe es zu dem Inhalt der Frage – Adi

Antwort

2

Guter Fang! Ich habe #3587 geschaffen, die für den Frühling-Boot 1.3

Dank angesprochen werden!

6

Als Alternative zum Warten auf Boot-1.3 können Sie Ihren eigenen Schlüssel zu application-development.properties wie

rabbit.auto-startup=false 

Dann fügen Sie Ihre AMQP-context.xml modify wie diese

<rabbit:listener-container connection-factory="connectionFactory" requeue-rejected="false" concurrency="10" auto-startup=${rabbit.auto-startup}> 
Verwandte Themen