bak-spring-jms-consumer.xml 1.53 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">


	<!-- 用于消息的监听的代理类MessageListenerAdapter -->
	<bean id="helloListenerAdapter"
		class="org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter">
		<constructor-arg ref="unionsMessageListener" />
		<property name="messageConverter" ref="messageConverter"></property>
	</bean>
	
	<!-- 用于消息的监听的容器类SimpleMessageListenerContainer,对于queueName的值一定要与定义的Queue的值相同 -->
	<bean id="listenerContainer"
		class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer">
		<property name="queueNames">
			<list>
				<value>unions-queue</value>
			</list>
		</property>
		<property name="connectionFactory" ref="connectionFactory"></property>
		<property name="messageListener" ref="helloListenerAdapter"></property>
	</bean>
</beans>