spring-common-rabbitmq.xml
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/rabbit
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="simpleMessageConverter-common" class="org.springframework.amqp.support.converter.SimpleMessageConverter"/>
<rabbit:connection-factory id="rabbitmq-connectionFactory-qq" addresses="${rabbit_common_qq:127.0.0.1:5672}"
username="${rabbit_common_qq_user:yoho}" password="${rabbit_common_qq_password:yoho}"
virtual-host="${rabbit_vhost:yoho}"/>
<rabbit:admin id="rabbitAdmin-qq" connection-factory="rabbitmq-connectionFactory-qq"/>
<rabbit:connection-factory id="rabbitmq-connectionFactory-aws" addresses="${rabbit_common_aws:127.0.0.1:5672}"
username="${rabbit_common_aws_user:yoho}" password="${rabbit_common_aws_password:yoho}"
virtual-host="${rabbit_vhost:yoho}"/>
<rabbit:admin id="rabbitAdmin-aws" connection-factory="rabbitmq-connectionFactory-aws"/>
<!--接收消息 -->
<bean id="commonConsumerFactory" class="com.yoho.unions.message.CommonConsumerFactory">
<!--这边admin的顺序和connectionFactory的顺序要一一对应-->
<constructor-arg name="admins">
<list>
<ref bean="rabbitAdmin-qq"/>
<ref bean="rabbitAdmin-aws"/>
</list>
</constructor-arg>
<constructor-arg name="connectionFactorys">
<list>
<ref bean="rabbitmq-connectionFactory-qq"/>
<ref bean="rabbitmq-connectionFactory-aws"/>
</list>
</constructor-arg>
<constructor-arg name="context" value="${web.context:default}"/>
<constructor-arg name="simpleMessageConverter" ref="simpleMessageConverter-common"/>
</bean>
</beans>