Skip to content

Instantly share code, notes, and snippets.

@patelm5
Last active December 11, 2015 02:38
Show Gist options
  • Save patelm5/4531624 to your computer and use it in GitHub Desktop.
Save patelm5/4531624 to your computer and use it in GitHub Desktop.
sample spring rabbit configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rabbit="http://www.springframework.org/schema/rabbit" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<rabbit:connection-factory id="connectionFactory" host="${rabbitmq.host:localhost}" port="${rabbitmq.port:5672}"
username="guest" password="guest" connection-factory="rcf" />
<bean id="rcf" class="com.rabbitmq.client.ConnectionFactory">
<property name="host" value="${rabbitmq.host:localhost}"/>
<property name="requestedHeartbeat" value="10" />
</bean>
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" reply-timeout="20000" />
<rabbit:admin connection-factory="connectionFactory" />
<rabbit:queue name="BroadcastQueue" >
<rabbit:queue-arguments value-type="java.lang.Long">
<entry key="x-message-ttl" value="2400000" />
</rabbit:queue-arguments>
</rabbit:queue>
<rabbit:listener-container connection-factory="connectionFactory">
<rabbit:listener queues="BroadcastQueue" ref="broadcastQueueConsumer" />
</rabbit:listener-container>
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment