Commit 30741703 307417038eaf7f3b6827447957808b8337d9b8de by xianghan@topdraw.cn

memberServiceFanoutConsumer:初始化广播队列和交换机

1 parent 98e6049d
...@@ -15,6 +15,8 @@ public class RabbitMqConfig { ...@@ -15,6 +15,8 @@ public class RabbitMqConfig {
15 public static final String UC_QUEUE_FANOUT_IPTV = "uc.fanout.iptv"; 15 public static final String UC_QUEUE_FANOUT_IPTV = "uc.fanout.iptv";
16 public static final String UC_QUEUE_FANOUT_WEIXIN = "uc.fanout.weixin"; 16 public static final String UC_QUEUE_FANOUT_WEIXIN = "uc.fanout.weixin";
17 17
18 public static final String UC_EXCHANGE_FANOUT = "uc.fanout";
19
18 20
19 /** 21 /**
20 * 处理事件 22 * 处理事件
......
...@@ -8,6 +8,7 @@ import com.topdraw.util.JSONUtil; ...@@ -8,6 +8,7 @@ import com.topdraw.util.JSONUtil;
8 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
9 import org.slf4j.Logger; 9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
11 import org.springframework.amqp.core.AcknowledgeMode;
11 import org.springframework.amqp.core.ExchangeTypes; 12 import org.springframework.amqp.core.ExchangeTypes;
12 import org.springframework.amqp.rabbit.annotation.*; 13 import org.springframework.amqp.rabbit.annotation.*;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
...@@ -29,7 +30,11 @@ public class MemberServiceConsumer { ...@@ -29,7 +30,11 @@ public class MemberServiceConsumer {
29 * @date 2021/9/7 11:26 上午 30 * @date 2021/9/7 11:26 上午
30 */ 31 */
31 @RabbitHandler 32 @RabbitHandler
32 @RabbitListener(queues = "#{memberServiceConsumer.platform()}") 33 // @RabbitListener(queues = "#{memberServiceConsumer.platform()}")
34 @RabbitListener(bindings = {
35 @QueueBinding(value = @Queue(value = "#{memberServiceConsumer.platform()}"),
36 exchange = @Exchange(value = RabbitMqConfig.UC_EXCHANGE_FANOUT,type = ExchangeTypes.FANOUT))
37 })
33 public void memberServiceFanoutConsumer(String content) { 38 public void memberServiceFanoutConsumer(String content) {
34 try { 39 try {
35 log.info(" receive dataSync msg , content is : {} ", content); 40 log.info(" receive dataSync msg , content is : {} ", content);
......
...@@ -59,15 +59,16 @@ spring: ...@@ -59,15 +59,16 @@ spring:
59 #连接超时时间 59 #连接超时时间
60 timeout: 5000 60 timeout: 5000
61 rabbitmq: 61 rabbitmq:
62 host: 122.112.214.149 # rabbitmq的连接地址 62 host: 47.100.212.170 # rabbitmq的连接地址
63 # host: 122.112.214.149 # rabbitmq的连接地址
63 #host: 139.196.192.242 # rabbitmq的连接地址 64 #host: 139.196.192.242 # rabbitmq的连接地址
64 port: 5672 # rabbitmq的连接端口号 65 port: 5672 # rabbitmq的连接端口号
65 #virtual-host: /member_center # rabbitmq的虚拟host 66 #virtual-host: /member_center # rabbitmq的虚拟host
66 #username: member_center # rabbitmq的用户名 67 #username: member_center # rabbitmq的用户名
67 #password: Tjlh@2021 # rabbitmq的密码 68 #password: Tjlh@2021 # rabbitmq的密码
68 virtual-host: / # rabbitmq的虚拟host 69 virtual-host: test # rabbitmq的虚拟host
69 username: guest # rabbitmq的用户名 70 username: omo_test # rabbitmq的用户名
70 password: guest # rabbitmq的密码 71 password: omo_test # rabbitmq的密码
71 publisher-confirms: true #如果对异步消息需要回调必须设置为true 72 publisher-confirms: true #如果对异步消息需要回调必须设置为true
72 73
73 #jwt。依赖的common中有需要jwt的部分属性。 74 #jwt。依赖的common中有需要jwt的部分属性。
......