java - Disabling the listening to rabbit queues from spring application.properties -


i want create application-development.properties file in spring define dev environment. in environment want disable listening rabbit queues because don't want interfere staging queues while debugging etc.

problem - can't find property controls this. no "active" property or "enabled" property or anything..

these properties found in spring docs:

# rabbit (rabbitproperties) spring.rabbitmq.addresses= # connection addresses (e.g. myhost:9999,otherhost:1111) spring.rabbitmq.dynamic=true # create 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; 0 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 handled in single request spring.rabbitmq.listener.transaction-size= # number of messages processed in transaction spring.rabbitmq.ssl.enabled=false # enable ssl support spring.rabbitmq.ssl.key-store= # path key store holds ssl certificate spring.rabbitmq.ssl.key-store-password= # password used access key store spring.rabbitmq.ssl.trust-store= # trust store holds ssl certificates spring.rabbitmq.ssl.trust-store-password= # password used access trust store spring.rabbitmq.username= # login user spring.rabbitmq.virtual-host= # virtual host use when connecting broker 

i did find way not load amqp-context.xml beans contain listener definitions using spring profiles , add <beans profile="development"> .. </beans> xml less flexible have define different profiles, , changing include involves changing code.

edit how amqp-context.xml looks like:

<?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> 

does have idea on how can manage listening queues directly application.properties file? please?

as alternative waiting boot 1.3, can add own key application-development.properties

rabbit.auto-startup=false 

then modify amqp-context.xml this

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

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -