37 lines
1.9 KiB
XML
37 lines
1.9 KiB
XML
|
|
<?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"
|
||
|
|
xmlns:util="http://www.springframework.org/schema/util"
|
||
|
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||
|
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||
|
|
http://www.springframework.org/schema/context
|
||
|
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||
|
|
http://www.springframework.org/schema/rabbit
|
||
|
|
http://www.springframework.org/schema/rabbit/spring-rabbit-1.6.xsd
|
||
|
|
http://www.springframework.org/schema/util
|
||
|
|
http://www.springframework.org/schema/util/spring-util-3.0.xsd">
|
||
|
|
|
||
|
|
<!--引入rabbitmq配置文件-->
|
||
|
|
<context:property-placeholder location="classpath:rabbitmq.properties" ignore-unresolvable="true"/>
|
||
|
|
|
||
|
|
|
||
|
|
<!--连接工厂-->
|
||
|
|
<rabbit:connection-factory id="connectionFactory"
|
||
|
|
username="${rabbit.username}" password="${rabbit.password}" host="${rabbit.host}"
|
||
|
|
port="${rabbit.port}" channel-cache-size="50" publisher-confirms="true"/>
|
||
|
|
|
||
|
|
<!-- 开启rabbitMQ注解 -->
|
||
|
|
<rabbit:annotation-driven />
|
||
|
|
<!-- 消息监听 -->
|
||
|
|
<bean id="rabbitListenerContainerFactory"
|
||
|
|
class="org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory">
|
||
|
|
<property name="connectionFactory" ref="connectionFactory" />
|
||
|
|
<property name="concurrentConsumers" value="3" />
|
||
|
|
<property name="maxConcurrentConsumers" value="10" />
|
||
|
|
<!--手动确认-->
|
||
|
|
<property name="acknowledgeMode" value="MANUAL"/>
|
||
|
|
</bean>
|
||
|
|
|
||
|
|
</beans>
|