Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ittaiz/3038262 to your computer and use it in GitHub Desktop.
Save ittaiz/3038262 to your computer and use it in GitHub Desktop.
A gist about the need of spring-amqp namespace limitation
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<util:properties id="queueProperties" location="classpath:/queueProperties.properties" />
<rabbit:direct-exchange name="#{indexingQueueProperties['mainExchange']}">
<rabbit:bindings>
<rabbit:binding key="#{queueProperties['routingKey']}" queue="myActualQueueName" />
</rabbit:bindings>
</rabbit:direct-exchange>
<rabbit:queue name="myActualQueueName" >
<rabbit:queue-arguments value-type="java.lang.String">
<entry key="x-dead-letter-exchange" value="#{queueProperties['mainDLQExchange']}" />
<entry key="x-ha-policy" value="all" />
</rabbit:queue-arguments>
</rabbit:queue>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<util:properties id="queueProperties" location="classpath:/queueProperties.properties" />
<rabbit:direct-exchange name="#{indexingQueueProperties['mainExchange']}">
<rabbit:bindings>
<rabbit:binding key="#{queueProperties['routingKey']}" queue="queueBeanName" />
</rabbit:bindings>
</rabbit:direct-exchange>
<bean name="queueBeanName" class="org.springframework.amqp.core.Queue">
<constructor-arg index="0" value="#{queueProperties['queueName']}" />
<constructor-arg index="1" value="true" />
<constructor-arg index="2" value="false" />
<constructor-arg index="3" value="false" />
<constructor-arg index="4">
<rabbit:queue-arguments value-type="java.lang.String">
<entry key="x-dead-letter-exchange" value="#{queueProperties['mainDLQExchange']}" />
<entry key="x-ha-policy" value="all" />
</rabbit:queue-arguments>
</constructor-arg>
</bean>
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment