bak-spring-jms.xml 1.56 KB
<?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:context="http://www.springframework.org/schema/context"
	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/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.0.xsd">


	<bean id="connectionFactory"
		class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
		<property name="host" value="${rabbit.mq.host}" />
		<property name="port" value="${rabbit.mq.port}" />
		<property name="username" value="${rabbit.mq.username}" />
		<property name="password" value="${rabbit.mq.password}" />
		<property name="virtualHost" value="${rabbit.mq.virtualHost}" />
	</bean>
	
	<bean id="rabbitAdmin" class="org.springframework.amqp.rabbit.core.RabbitAdmin">
		<constructor-arg ref="connectionFactory" />
	</bean>

	<!-- 声明Queue并设定Queue的名称 -->
	<bean class="org.springframework.amqp.core.Queue">
		<constructor-arg value="unions-queue" />
	</bean>
	
	<!-- 声明消息转换器为SimpleMessageConverter -->
	<bean id="messageConverter"
		class="org.springframework.amqp.support.converter.SimpleMessageConverter">
	</bean>
</beans>