Explorar o código

消息驱动改成springcloudstream

gaodm %!s(int64=6) %!d(string=hai) anos
pai
achega
e0b4b20395
Modificáronse 58 ficheiros con 463 adicións e 440 borrados
  1. 5 0
      bi-service/pom.xml
  2. 3 3
      bi-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java
  3. 0 38
      bi-service/src/main/java/com/diagbot/config/RabbitConfig.java
  4. 23 0
      bi-service/src/main/java/com/diagbot/rabbit/MyProcessor.java
  5. 27 0
      bi-service/src/main/java/com/diagbot/rabbit/MySender.java
  6. 0 3
      bi-service/src/main/java/com/diagbot/service/SysLogService.java
  7. 0 12
      bi-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java
  8. 7 0
      config-server/src/main/resources/shared/bi-service-dev.yml
  9. 7 0
      config-server/src/main/resources/shared/bi-service-local.yml
  10. 7 0
      config-server/src/main/resources/shared/diagbotman-service-dev.yml
  11. 7 0
      config-server/src/main/resources/shared/diagbotman-service-local.yml
  12. 7 0
      config-server/src/main/resources/shared/feedback-service-dev.yml
  13. 7 0
      config-server/src/main/resources/shared/feedback-service-local.yml
  14. 7 0
      config-server/src/main/resources/shared/knowledge-service-dev.yml
  15. 7 0
      config-server/src/main/resources/shared/knowledge-service-local.yml
  16. 10 0
      config-server/src/main/resources/shared/logger-service-dev.yml
  17. 10 0
      config-server/src/main/resources/shared/logger-service-local.yml
  18. 7 0
      config-server/src/main/resources/shared/user-service-dev.yml
  19. 7 0
      config-server/src/main/resources/shared/user-service-local.yml
  20. 5 0
      diagbotman-service/pom.xml
  21. 3 3
      diagbotman-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java
  22. 0 38
      diagbotman-service/src/main/java/com/diagbot/config/RabbitConfig.java
  23. 23 0
      diagbotman-service/src/main/java/com/diagbot/rabbit/MyProcessor.java
  24. 27 0
      diagbotman-service/src/main/java/com/diagbot/rabbit/MySender.java
  25. 0 3
      diagbotman-service/src/main/java/com/diagbot/service/SysLogService.java
  26. 0 12
      diagbotman-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java
  27. 5 0
      feedback-service/pom.xml
  28. 3 3
      feedback-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java
  29. 0 38
      feedback-service/src/main/java/com/diagbot/config/RabbitConfig.java
  30. 23 0
      feedback-service/src/main/java/com/diagbot/rabbit/MyProcessor.java
  31. 27 0
      feedback-service/src/main/java/com/diagbot/rabbit/MySender.java
  32. 0 3
      feedback-service/src/main/java/com/diagbot/service/SysLogService.java
  33. 0 12
      feedback-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java
  34. 5 0
      knowledge-service/pom.xml
  35. 3 3
      knowledge-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java
  36. 0 38
      knowledge-service/src/main/java/com/diagbot/config/RabbitConfig.java
  37. 23 0
      knowledge-service/src/main/java/com/diagbot/rabbit/MyProcessor.java
  38. 27 0
      knowledge-service/src/main/java/com/diagbot/rabbit/MySender.java
  39. 0 3
      knowledge-service/src/main/java/com/diagbot/service/SysLogService.java
  40. 0 12
      knowledge-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java
  41. 5 0
      log-service/pom.xml
  42. 3 2
      log-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java
  43. 0 57
      log-service/src/main/java/com/diagbot/config/RabbitConfig.java
  44. 23 0
      log-service/src/main/java/com/diagbot/rabbit/MyProcessor.java
  45. 25 0
      log-service/src/main/java/com/diagbot/rabbit/MyReceiver.java
  46. 27 0
      log-service/src/main/java/com/diagbot/rabbit/MySender.java
  47. 0 31
      log-service/src/main/java/com/diagbot/rabbit/Receiver.java
  48. 0 18
      log-service/src/main/java/com/diagbot/rabbit/Sender.java
  49. 0 3
      log-service/src/main/java/com/diagbot/service/SysLogService.java
  50. 0 12
      log-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java
  51. 5 0
      user-service/pom.xml
  52. 3 3
      user-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java
  53. 0 38
      user-service/src/main/java/com/diagbot/config/RabbitConfig.java
  54. 0 13
      user-service/src/main/java/com/diagbot/facade/LoggerFacade.java
  55. 23 0
      user-service/src/main/java/com/diagbot/rabbit/MyProcessor.java
  56. 27 0
      user-service/src/main/java/com/diagbot/rabbit/MySender.java
  57. 0 13
      user-service/src/main/java/com/diagbot/service/LoggerService.java
  58. 0 26
      user-service/src/main/java/com/diagbot/service/impl/LoggerServiceImpl.java

+ 5 - 0
bi-service/pom.xml

@@ -157,6 +157,11 @@
             <version>${mybatis-spring-boot.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 3 - 3
bi-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java

@@ -3,7 +3,7 @@ package com.diagbot.aop;
 import com.alibaba.fastjson.JSON;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.entity.SysLog;
-import com.diagbot.facade.SysLogFacade;
+import com.diagbot.rabbit.MySender;
 import com.diagbot.util.HttpUtils;
 import com.diagbot.util.UserUtils;
 import org.apache.commons.lang.StringUtils;
@@ -27,7 +27,7 @@ import java.util.Date;
 @Component
 public class SysLoggerAspect {
     @Autowired
-    private SysLogFacade sysLogFacade;
+    private MySender mySender;
 
     @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
     public void loggerPointCut() {
@@ -67,7 +67,7 @@ public class SysLoggerAspect {
         }
         sysLog.setCreateDate(new Date());
         //保存系统日志
-        sysLogFacade.log(sysLog);
+        mySender.outputLogSend(sysLog);
     }
 
 }

+ 0 - 38
bi-service/src/main/java/com/diagbot/config/RabbitConfig.java

@@ -1,38 +0,0 @@
-package com.diagbot.config;
-
-
-import org.springframework.amqp.core.Binding;
-import org.springframework.amqp.core.BindingBuilder;
-import org.springframework.amqp.core.Queue;
-import org.springframework.amqp.core.TopicExchange;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @Description: 消息配置类
- * @author: gaodm
- * @time: 2018/8/2 14:21
- */
-@Configuration
-public class RabbitConfig {
-
-
-  public   final static String queueName = "spring-boot";
-
-    @Bean
-    Queue queue() {
-        return new Queue(queueName, false);
-    }
-
-    @Bean
-    TopicExchange exchange() {
-        return new TopicExchange("spring-boot-exchange");
-    }
-
-    @Bean
-    Binding binding(Queue queue, TopicExchange exchange) {
-        return BindingBuilder.bind(queue).to(exchange).with(queueName);
-    }
-
-
-}

+ 23 - 0
bi-service/src/main/java/com/diagbot/rabbit/MyProcessor.java

@@ -0,0 +1,23 @@
+package com.diagbot.rabbit;
+
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.annotation.Output;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.SubscribableChannel;
+
+/**
+ * @Description: 自定义Stream发布和消费对象
+ * @author: gaodm
+ * @time: 2018/8/29 13:39
+ */
+public interface MyProcessor {
+
+    String INPUT_LOG = "inputLog";
+    String OUTPUT_LOG = "outputLog";
+
+    @Input(INPUT_LOG)
+    SubscribableChannel inputLog();
+
+    @Output(OUTPUT_LOG)
+    MessageChannel outputLog();
+}

+ 27 - 0
bi-service/src/main/java/com/diagbot/rabbit/MySender.java

@@ -0,0 +1,27 @@
+package com.diagbot.rabbit;
+
+import com.alibaba.fastjson.JSON;
+import com.diagbot.entity.SysLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 发布者
+ * @author: gaodm
+ * @time: 2018/8/29 13:41
+ */
+@Component
+@EnableBinding({MyProcessor.class})
+public class MySender {
+    @Autowired
+    @Qualifier("outputLog")
+    MessageChannel outputLog;
+
+    public void outputLogSend(SysLog sysLog){
+        outputLog.send(MessageBuilder.withPayload(JSON.toJSONString(sysLog)).build());
+    }
+}

+ 0 - 3
bi-service/src/main/java/com/diagbot/service/SysLogService.java

@@ -12,7 +12,4 @@ import com.diagbot.entity.SysLog;
  * @since 2018-08-02
  */
 public interface SysLogService extends IService<SysLog> {
-
-    void log(SysLog sysLog);
-
 }

+ 0 - 12
bi-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java

@@ -1,13 +1,9 @@
 package com.diagbot.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.config.RabbitConfig;
 import com.diagbot.entity.SysLog;
 import com.diagbot.mapper.SysLogMapper;
 import com.diagbot.service.SysLogService;
-import org.springframework.amqp.core.AmqpTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -20,12 +16,4 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
-
-    @Autowired
-    private AmqpTemplate rabbitTemplate;
-
-    @Override
-    public void log(SysLog sysLog){
-        rabbitTemplate.convertAndSend(RabbitConfig.queueName, JSON.toJSONString(sysLog));
-    }
 }

+ 7 - 0
config-server/src/main/resources/shared/bi-service-dev.yml

@@ -58,6 +58,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: 192.168.2.236

+ 7 - 0
config-server/src/main/resources/shared/bi-service-local.yml

@@ -58,6 +58,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: localhost

+ 7 - 0
config-server/src/main/resources/shared/diagbotman-service-dev.yml

@@ -58,6 +58,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: 192.168.2.236

+ 7 - 0
config-server/src/main/resources/shared/diagbotman-service-local.yml

@@ -58,6 +58,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: localhost

+ 7 - 0
config-server/src/main/resources/shared/feedback-service-dev.yml

@@ -58,6 +58,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: 192.168.2.236

+ 7 - 0
config-server/src/main/resources/shared/feedback-service-local.yml

@@ -58,6 +58,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: localhost

+ 7 - 0
config-server/src/main/resources/shared/knowledge-service-dev.yml

@@ -58,6 +58,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: 192.168.2.236

+ 7 - 0
config-server/src/main/resources/shared/knowledge-service-local.yml

@@ -58,6 +58,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: localhost

+ 10 - 0
config-server/src/main/resources/shared/logger-service-dev.yml

@@ -59,6 +59,16 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+        inputLog:
+          destination: myLog
+          group: logReceiveGroup     # 具体分组 对应 MQ 是 队列名称 并且持久化队列
+
   #mq
   rabbitmq:
     host: 192.168.2.236

+ 10 - 0
config-server/src/main/resources/shared/logger-service-local.yml

@@ -59,6 +59,16 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+        inputLog:
+          destination: myLog
+          group: logReceiveGroup     # 具体分组 对应 MQ 是 队列名称 并且持久化队列
+
   #mq
   rabbitmq:
     host: localhost

+ 7 - 0
config-server/src/main/resources/shared/user-service-dev.yml

@@ -59,6 +59,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: 192.168.2.236

+ 7 - 0
config-server/src/main/resources/shared/user-service-local.yml

@@ -59,6 +59,13 @@ spring:
         login-username: root
         login-password: root
 
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+#          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
   #mq
   rabbitmq:
     host: localhost

+ 5 - 0
diagbotman-service/pom.xml

@@ -157,6 +157,11 @@
             <version>${mybatis-spring-boot.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 3 - 3
diagbotman-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java

@@ -3,7 +3,7 @@ package com.diagbot.aop;
 import com.alibaba.fastjson.JSON;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.entity.SysLog;
-import com.diagbot.facade.SysLogFacade;
+import com.diagbot.rabbit.MySender;
 import com.diagbot.util.HttpUtils;
 import com.diagbot.util.UserUtils;
 import org.apache.commons.lang.StringUtils;
@@ -27,7 +27,7 @@ import java.util.Date;
 @Component
 public class SysLoggerAspect {
     @Autowired
-    private SysLogFacade sysLogFacade;
+    private MySender mySender;
 
     @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
     public void loggerPointCut() {
@@ -67,7 +67,7 @@ public class SysLoggerAspect {
         }
         sysLog.setCreateDate(new Date());
         //保存系统日志
-        sysLogFacade.log(sysLog);
+        mySender.outputLogSend(sysLog);
     }
 
 }

+ 0 - 38
diagbotman-service/src/main/java/com/diagbot/config/RabbitConfig.java

@@ -1,38 +0,0 @@
-package com.diagbot.config;
-
-
-import org.springframework.amqp.core.Binding;
-import org.springframework.amqp.core.BindingBuilder;
-import org.springframework.amqp.core.Queue;
-import org.springframework.amqp.core.TopicExchange;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @Description: 消息配置类
- * @author: gaodm
- * @time: 2018/8/2 14:21
- */
-@Configuration
-public class RabbitConfig {
-
-
-  public   final static String queueName = "spring-boot";
-
-    @Bean
-    Queue queue() {
-        return new Queue(queueName, false);
-    }
-
-    @Bean
-    TopicExchange exchange() {
-        return new TopicExchange("spring-boot-exchange");
-    }
-
-    @Bean
-    Binding binding(Queue queue, TopicExchange exchange) {
-        return BindingBuilder.bind(queue).to(exchange).with(queueName);
-    }
-
-
-}

+ 23 - 0
diagbotman-service/src/main/java/com/diagbot/rabbit/MyProcessor.java

@@ -0,0 +1,23 @@
+package com.diagbot.rabbit;
+
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.annotation.Output;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.SubscribableChannel;
+
+/**
+ * @Description: 自定义Stream发布和消费对象
+ * @author: gaodm
+ * @time: 2018/8/29 13:39
+ */
+public interface MyProcessor {
+
+    String INPUT_LOG = "inputLog";
+    String OUTPUT_LOG = "outputLog";
+
+    @Input(INPUT_LOG)
+    SubscribableChannel inputLog();
+
+    @Output(OUTPUT_LOG)
+    MessageChannel outputLog();
+}

+ 27 - 0
diagbotman-service/src/main/java/com/diagbot/rabbit/MySender.java

@@ -0,0 +1,27 @@
+package com.diagbot.rabbit;
+
+import com.alibaba.fastjson.JSON;
+import com.diagbot.entity.SysLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 发布者
+ * @author: gaodm
+ * @time: 2018/8/29 13:41
+ */
+@Component
+@EnableBinding({MyProcessor.class})
+public class MySender {
+    @Autowired
+    @Qualifier("outputLog")
+    MessageChannel outputLog;
+
+    public void outputLogSend(SysLog sysLog){
+        outputLog.send(MessageBuilder.withPayload(JSON.toJSONString(sysLog)).build());
+    }
+}

+ 0 - 3
diagbotman-service/src/main/java/com/diagbot/service/SysLogService.java

@@ -12,7 +12,4 @@ import com.diagbot.entity.SysLog;
  * @since 2018-08-02
  */
 public interface SysLogService extends IService<SysLog> {
-
-    void log(SysLog sysLog);
-
 }

+ 0 - 12
diagbotman-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java

@@ -1,13 +1,9 @@
 package com.diagbot.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.config.RabbitConfig;
 import com.diagbot.entity.SysLog;
 import com.diagbot.mapper.SysLogMapper;
 import com.diagbot.service.SysLogService;
-import org.springframework.amqp.core.AmqpTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -20,12 +16,4 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
-
-    @Autowired
-    private AmqpTemplate rabbitTemplate;
-
-    @Override
-    public void log(SysLog sysLog){
-        rabbitTemplate.convertAndSend(RabbitConfig.queueName, JSON.toJSONString(sysLog));
-    }
 }

+ 5 - 0
feedback-service/pom.xml

@@ -157,6 +157,11 @@
             <version>${mybatis-spring-boot.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 3 - 3
feedback-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java

@@ -3,7 +3,7 @@ package com.diagbot.aop;
 import com.alibaba.fastjson.JSON;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.entity.SysLog;
-import com.diagbot.facade.SysLogFacade;
+import com.diagbot.rabbit.MySender;
 import com.diagbot.util.HttpUtils;
 import com.diagbot.util.UserUtils;
 import org.apache.commons.lang.StringUtils;
@@ -27,7 +27,7 @@ import java.util.Date;
 @Component
 public class SysLoggerAspect {
     @Autowired
-    private SysLogFacade sysLogFacade;
+    private MySender mySender;
 
     @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
     public void loggerPointCut() {
@@ -67,7 +67,7 @@ public class SysLoggerAspect {
         }
         sysLog.setCreateDate(new Date());
         //保存系统日志
-        sysLogFacade.log(sysLog);
+        mySender.outputLogSend(sysLog);
     }
 
 }

+ 0 - 38
feedback-service/src/main/java/com/diagbot/config/RabbitConfig.java

@@ -1,38 +0,0 @@
-package com.diagbot.config;
-
-
-import org.springframework.amqp.core.Binding;
-import org.springframework.amqp.core.BindingBuilder;
-import org.springframework.amqp.core.Queue;
-import org.springframework.amqp.core.TopicExchange;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @Description: 消息配置类
- * @author: gaodm
- * @time: 2018/8/2 14:21
- */
-@Configuration
-public class RabbitConfig {
-
-
-  public   final static String queueName = "spring-boot";
-
-    @Bean
-    Queue queue() {
-        return new Queue(queueName, false);
-    }
-
-    @Bean
-    TopicExchange exchange() {
-        return new TopicExchange("spring-boot-exchange");
-    }
-
-    @Bean
-    Binding binding(Queue queue, TopicExchange exchange) {
-        return BindingBuilder.bind(queue).to(exchange).with(queueName);
-    }
-
-
-}

+ 23 - 0
feedback-service/src/main/java/com/diagbot/rabbit/MyProcessor.java

@@ -0,0 +1,23 @@
+package com.diagbot.rabbit;
+
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.annotation.Output;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.SubscribableChannel;
+
+/**
+ * @Description: 自定义Stream发布和消费对象
+ * @author: gaodm
+ * @time: 2018/8/29 13:39
+ */
+public interface MyProcessor {
+
+    String INPUT_LOG = "inputLog";
+    String OUTPUT_LOG = "outputLog";
+
+    @Input(INPUT_LOG)
+    SubscribableChannel inputLog();
+
+    @Output(OUTPUT_LOG)
+    MessageChannel outputLog();
+}

+ 27 - 0
feedback-service/src/main/java/com/diagbot/rabbit/MySender.java

@@ -0,0 +1,27 @@
+package com.diagbot.rabbit;
+
+import com.alibaba.fastjson.JSON;
+import com.diagbot.entity.SysLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 发布者
+ * @author: gaodm
+ * @time: 2018/8/29 13:41
+ */
+@Component
+@EnableBinding({MyProcessor.class})
+public class MySender {
+    @Autowired
+    @Qualifier("outputLog")
+    MessageChannel outputLog;
+
+    public void outputLogSend(SysLog sysLog){
+        outputLog.send(MessageBuilder.withPayload(JSON.toJSONString(sysLog)).build());
+    }
+}

+ 0 - 3
feedback-service/src/main/java/com/diagbot/service/SysLogService.java

@@ -12,7 +12,4 @@ import com.diagbot.entity.SysLog;
  * @since 2018-08-02
  */
 public interface SysLogService extends IService<SysLog> {
-
-    void log(SysLog sysLog);
-
 }

+ 0 - 12
feedback-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java

@@ -1,13 +1,9 @@
 package com.diagbot.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.config.RabbitConfig;
 import com.diagbot.entity.SysLog;
 import com.diagbot.mapper.SysLogMapper;
 import com.diagbot.service.SysLogService;
-import org.springframework.amqp.core.AmqpTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -20,12 +16,4 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
-
-    @Autowired
-    private AmqpTemplate rabbitTemplate;
-
-    @Override
-    public void log(SysLog sysLog){
-        rabbitTemplate.convertAndSend(RabbitConfig.queueName, JSON.toJSONString(sysLog));
-    }
 }

+ 5 - 0
knowledge-service/pom.xml

@@ -157,6 +157,11 @@
             <version>${mybatis-spring-boot.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 3 - 3
knowledge-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java

@@ -3,7 +3,7 @@ package com.diagbot.aop;
 import com.alibaba.fastjson.JSON;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.entity.SysLog;
-import com.diagbot.facade.SysLogFacade;
+import com.diagbot.rabbit.MySender;
 import com.diagbot.util.HttpUtils;
 import com.diagbot.util.UserUtils;
 import org.apache.commons.lang.StringUtils;
@@ -27,7 +27,7 @@ import java.util.Date;
 @Component
 public class SysLoggerAspect {
     @Autowired
-    private SysLogFacade sysLogFacade;
+    private MySender mySender;
 
     @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
     public void loggerPointCut() {
@@ -67,7 +67,7 @@ public class SysLoggerAspect {
         }
         sysLog.setCreateDate(new Date());
         //保存系统日志
-        sysLogFacade.log(sysLog);
+        mySender.outputLogSend(sysLog);
     }
 
 }

+ 0 - 38
knowledge-service/src/main/java/com/diagbot/config/RabbitConfig.java

@@ -1,38 +0,0 @@
-package com.diagbot.config;
-
-
-import org.springframework.amqp.core.Binding;
-import org.springframework.amqp.core.BindingBuilder;
-import org.springframework.amqp.core.Queue;
-import org.springframework.amqp.core.TopicExchange;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @Description: 消息配置类
- * @author: gaodm
- * @time: 2018/8/2 14:21
- */
-@Configuration
-public class RabbitConfig {
-
-
-  public   final static String queueName = "spring-boot";
-
-    @Bean
-    Queue queue() {
-        return new Queue(queueName, false);
-    }
-
-    @Bean
-    TopicExchange exchange() {
-        return new TopicExchange("spring-boot-exchange");
-    }
-
-    @Bean
-    Binding binding(Queue queue, TopicExchange exchange) {
-        return BindingBuilder.bind(queue).to(exchange).with(queueName);
-    }
-
-
-}

+ 23 - 0
knowledge-service/src/main/java/com/diagbot/rabbit/MyProcessor.java

@@ -0,0 +1,23 @@
+package com.diagbot.rabbit;
+
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.annotation.Output;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.SubscribableChannel;
+
+/**
+ * @Description: 自定义Stream发布和消费对象
+ * @author: gaodm
+ * @time: 2018/8/29 13:39
+ */
+public interface MyProcessor {
+
+    String INPUT_LOG = "inputLog";
+    String OUTPUT_LOG = "outputLog";
+
+    @Input(INPUT_LOG)
+    SubscribableChannel inputLog();
+
+    @Output(OUTPUT_LOG)
+    MessageChannel outputLog();
+}

+ 27 - 0
knowledge-service/src/main/java/com/diagbot/rabbit/MySender.java

@@ -0,0 +1,27 @@
+package com.diagbot.rabbit;
+
+import com.alibaba.fastjson.JSON;
+import com.diagbot.entity.SysLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 发布者
+ * @author: gaodm
+ * @time: 2018/8/29 13:41
+ */
+@Component
+@EnableBinding({MyProcessor.class})
+public class MySender {
+    @Autowired
+    @Qualifier("outputLog")
+    MessageChannel outputLog;
+
+    public void outputLogSend(SysLog sysLog){
+        outputLog.send(MessageBuilder.withPayload(JSON.toJSONString(sysLog)).build());
+    }
+}

+ 0 - 3
knowledge-service/src/main/java/com/diagbot/service/SysLogService.java

@@ -12,7 +12,4 @@ import com.diagbot.entity.SysLog;
  * @since 2018-08-02
  */
 public interface SysLogService extends IService<SysLog> {
-
-    void log(SysLog sysLog);
-
 }

+ 0 - 12
knowledge-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java

@@ -1,13 +1,9 @@
 package com.diagbot.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.config.RabbitConfig;
 import com.diagbot.entity.SysLog;
 import com.diagbot.mapper.SysLogMapper;
 import com.diagbot.service.SysLogService;
-import org.springframework.amqp.core.AmqpTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -20,12 +16,4 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
-
-    @Autowired
-    private AmqpTemplate rabbitTemplate;
-
-    @Override
-    public void log(SysLog sysLog){
-        rabbitTemplate.convertAndSend(RabbitConfig.queueName, JSON.toJSONString(sysLog));
-    }
 }

+ 5 - 0
log-service/pom.xml

@@ -157,6 +157,11 @@
             <version>${mybatis-spring-boot.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 3 - 2
log-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.entity.SysLog;
 import com.diagbot.facade.SysLogFacade;
+import com.diagbot.rabbit.MySender;
 import com.diagbot.util.HttpUtils;
 import com.diagbot.util.UserUtils;
 import org.apache.commons.lang.StringUtils;
@@ -27,7 +28,7 @@ import java.util.Date;
 @Component
 public class SysLoggerAspect {
     @Autowired
-    private SysLogFacade sysLogFacade;
+    private MySender mySender;
 
     @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
     public void loggerPointCut() {
@@ -67,7 +68,7 @@ public class SysLoggerAspect {
         }
         sysLog.setCreateDate(new Date());
         //保存系统日志
-        sysLogFacade.log(sysLog);
+        mySender.outputLogSend(sysLog);
     }
 
 }

+ 0 - 57
log-service/src/main/java/com/diagbot/config/RabbitConfig.java

@@ -1,57 +0,0 @@
-package com.diagbot.config;
-
-
-import com.diagbot.rabbit.Receiver;
-import org.springframework.amqp.core.Binding;
-import org.springframework.amqp.core.BindingBuilder;
-import org.springframework.amqp.core.Queue;
-import org.springframework.amqp.core.TopicExchange;
-import org.springframework.amqp.rabbit.connection.ConnectionFactory;
-import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
-import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @Description: 消息消费者配置
- * @author: gaodm
- * @time: 2018/8/1 14:59
- */
-@Configuration
-public class RabbitConfig {
-
-
-  public   final static String queueName = "spring-boot";
-
-    @Bean
-    Queue queue() {
-        return new Queue(queueName, false);
-    }
-
-    @Bean
-    TopicExchange exchange() {
-        return new TopicExchange("spring-boot-exchange");
-    }
-
-    @Bean
-    Binding binding(Queue queue, TopicExchange exchange) {
-        return BindingBuilder.bind(queue).to(exchange).with(queueName);
-    }
-
-    @Bean
-    SimpleMessageListenerContainer container(ConnectionFactory connectionFactory,
-                                             MessageListenerAdapter listenerAdapter) {
-        SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
-        container.setConnectionFactory(connectionFactory);
-        container.setQueueNames(queueName);
-        container.setMessageListener(listenerAdapter);
-        return container;
-    }
-
-    @Bean
-    MessageListenerAdapter listenerAdapter(Receiver receiver) {
-        return new MessageListenerAdapter(receiver, "receiveMessage");
-    }
-
-
-}

+ 23 - 0
log-service/src/main/java/com/diagbot/rabbit/MyProcessor.java

@@ -0,0 +1,23 @@
+package com.diagbot.rabbit;
+
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.annotation.Output;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.SubscribableChannel;
+
+/**
+ * @Description: 自定义Stream发布和消费对象
+ * @author: gaodm
+ * @time: 2018/8/29 13:39
+ */
+public interface MyProcessor {
+
+    String INPUT_LOG = "inputLog";
+    String OUTPUT_LOG = "outputLog";
+
+    @Input(INPUT_LOG)
+    SubscribableChannel inputLog();
+
+    @Output(OUTPUT_LOG)
+    MessageChannel outputLog();
+}

+ 25 - 0
log-service/src/main/java/com/diagbot/rabbit/MyReceiver.java

@@ -0,0 +1,25 @@
+package com.diagbot.rabbit;
+
+import com.alibaba.fastjson.JSON;
+import com.diagbot.entity.SysLog;
+import com.diagbot.facade.SysLogFacade;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.cloud.stream.annotation.StreamListener;
+
+/**
+ * @Description: 消费者
+ * @author: gaodm
+ * @time: 2018/8/29 14:02
+ */
+@EnableBinding({MyProcessor.class})
+public class MyReceiver {
+    @Autowired
+    SysLogFacade sysLogFacade;
+    @StreamListener(MyProcessor.INPUT_LOG)
+    public void inputLog (String message) {
+        System.out.println("Received <" + message + ">");
+        SysLog sysLog=  JSON.parseObject(message, SysLog.class);
+        sysLogFacade.save(sysLog);
+    }
+}

+ 27 - 0
log-service/src/main/java/com/diagbot/rabbit/MySender.java

@@ -0,0 +1,27 @@
+package com.diagbot.rabbit;
+
+import com.alibaba.fastjson.JSON;
+import com.diagbot.entity.SysLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 发布者
+ * @author: gaodm
+ * @time: 2018/8/29 13:41
+ */
+@Component
+@EnableBinding({MyProcessor.class})
+public class MySender {
+    @Autowired
+    @Qualifier("outputLog")
+    MessageChannel outputLog;
+
+    public void outputLogSend(SysLog sysLog){
+        outputLog.send(MessageBuilder.withPayload(JSON.toJSONString(sysLog)).build());
+    }
+}

+ 0 - 31
log-service/src/main/java/com/diagbot/rabbit/Receiver.java

@@ -1,31 +0,0 @@
-package com.diagbot.rabbit;
-
-import com.alibaba.fastjson.JSON;
-import com.diagbot.entity.SysLog;
-import com.diagbot.facade.SysLogFacade;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.concurrent.CountDownLatch;
-
-/**
- * @Description: 消费者处理
- * @author: gaodm
- * @time: 2018/8/1 17:02
- */
-@Component
-public class Receiver {
-
-    private CountDownLatch latch = new CountDownLatch(1);
-
-    @Autowired
-    SysLogFacade sysLogFacade;
-    public void receiveMessage(String message) {
-        System.out.println("Received <" + message + ">");
-        SysLog  sysLog=  JSON.parseObject(message,SysLog.class);
-        sysLogFacade.save(sysLog);
-        latch.countDown();
-    }
-
-
-}

+ 0 - 18
log-service/src/main/java/com/diagbot/rabbit/Sender.java

@@ -1,18 +0,0 @@
-package com.diagbot.rabbit;
-
-///**
-// * Created by gaodm on 2018/8/1.
-// */
-//@Component
-//public class Sender {
-//
-//    @Autowired
-//    private AmqpTemplate rabbitTemplate;
-//
-//    public void send() {
-//        String context = "hello " + new Date();
-//        System.out.println("Sender : " + context);
-//        rabbitTemplate.convertAndSend(RabbitConfig.queueName, "Hello from RabbitMQ!");
-//    }
-//
-//}

+ 0 - 3
log-service/src/main/java/com/diagbot/service/SysLogService.java

@@ -12,7 +12,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2018-08-02
  */
 public interface SysLogService extends IService<SysLog> {
-
-    void log(SysLog sysLog);
-
 }

+ 0 - 12
log-service/src/main/java/com/diagbot/service/impl/SysLogServiceImpl.java

@@ -1,13 +1,9 @@
 package com.diagbot.service.impl;
 
-import com.alibaba.fastjson.JSON;
-import com.diagbot.config.RabbitConfig;
 import com.diagbot.entity.SysLog;
 import com.diagbot.mapper.SysLogMapper;
 import com.diagbot.service.SysLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.amqp.core.AmqpTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -20,12 +16,4 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
-
-    @Autowired
-    private AmqpTemplate rabbitTemplate;
-
-    @Override
-    public void log(SysLog sysLog){
-        rabbitTemplate.convertAndSend(RabbitConfig.queueName, JSON.toJSONString(sysLog));
-    }
 }

+ 5 - 0
user-service/pom.xml

@@ -157,6 +157,11 @@
             <version>${mybatis-spring-boot.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 3 - 3
user-service/src/main/java/com/diagbot/aop/SysLoggerAspect.java

@@ -3,7 +3,7 @@ package com.diagbot.aop;
 import com.alibaba.fastjson.JSON;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.entity.SysLog;
-import com.diagbot.facade.LoggerFacade;
+import com.diagbot.rabbit.MySender;
 import com.diagbot.util.HttpUtils;
 import com.diagbot.util.UserUtils;
 import org.apache.commons.lang.StringUtils;
@@ -27,7 +27,7 @@ import java.util.Date;
 @Component
 public class SysLoggerAspect {
     @Autowired
-    private LoggerFacade loggerFacade;
+    private MySender mySender;
 
     @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
     public void loggerPointCut() {
@@ -67,7 +67,7 @@ public class SysLoggerAspect {
         }
         sysLog.setCreateDate(new Date());
         //保存系统日志
-        loggerFacade.log(sysLog);
+        mySender.outputLogSend(sysLog);
     }
 
 }

+ 0 - 38
user-service/src/main/java/com/diagbot/config/RabbitConfig.java

@@ -1,38 +0,0 @@
-package com.diagbot.config;
-
-
-import org.springframework.amqp.core.Binding;
-import org.springframework.amqp.core.BindingBuilder;
-import org.springframework.amqp.core.Queue;
-import org.springframework.amqp.core.TopicExchange;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @Description: 消息配置类
- * @author: gaodm
- * @time: 2018/8/2 14:21
- */
-@Configuration
-public class RabbitConfig {
-
-
-  public   final static String queueName = "spring-boot";
-
-    @Bean
-    Queue queue() {
-        return new Queue(queueName, false);
-    }
-
-    @Bean
-    TopicExchange exchange() {
-        return new TopicExchange("spring-boot-exchange");
-    }
-
-    @Bean
-    Binding binding(Queue queue, TopicExchange exchange) {
-        return BindingBuilder.bind(queue).to(exchange).with(queueName);
-    }
-
-
-}

+ 0 - 13
user-service/src/main/java/com/diagbot/facade/LoggerFacade.java

@@ -1,13 +0,0 @@
-package com.diagbot.facade;
-
-import com.diagbot.service.impl.LoggerServiceImpl;
-import org.springframework.stereotype.Component;
-
-/**
- * @Description: 日志业务层
- * @author: gaodm
- * @time: 2018/8/6 8:59
- */
-@Component
-public class LoggerFacade extends LoggerServiceImpl {
-}

+ 23 - 0
user-service/src/main/java/com/diagbot/rabbit/MyProcessor.java

@@ -0,0 +1,23 @@
+package com.diagbot.rabbit;
+
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.annotation.Output;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.SubscribableChannel;
+
+/**
+ * @Description: 自定义Stream发布和消费对象
+ * @author: gaodm
+ * @time: 2018/8/29 13:39
+ */
+public interface MyProcessor {
+
+    String INPUT_LOG = "inputLog";
+    String OUTPUT_LOG = "outputLog";
+
+    @Input(INPUT_LOG)
+    SubscribableChannel inputLog();
+
+    @Output(OUTPUT_LOG)
+    MessageChannel outputLog();
+}

+ 27 - 0
user-service/src/main/java/com/diagbot/rabbit/MySender.java

@@ -0,0 +1,27 @@
+package com.diagbot.rabbit;
+
+import com.alibaba.fastjson.JSON;
+import com.diagbot.entity.SysLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 发布者
+ * @author: gaodm
+ * @time: 2018/8/29 13:41
+ */
+@Component
+@EnableBinding({MyProcessor.class})
+public class MySender {
+    @Autowired
+    @Qualifier("outputLog")
+    MessageChannel outputLog;
+
+    public void outputLogSend(SysLog sysLog){
+        outputLog.send(MessageBuilder.withPayload(JSON.toJSONString(sysLog)).build());
+    }
+}

+ 0 - 13
user-service/src/main/java/com/diagbot/service/LoggerService.java

@@ -1,13 +0,0 @@
-package com.diagbot.service;
-
-import com.diagbot.entity.SysLog;
-
-/**
- * @Description: 日志服务层
- * @author: gaodm
- * @time: 2018/8/2 13:50
- */
-public interface LoggerService {
-
-    void log(SysLog sysLog);
-}

+ 0 - 26
user-service/src/main/java/com/diagbot/service/impl/LoggerServiceImpl.java

@@ -1,26 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.alibaba.fastjson.JSON;
-import com.diagbot.config.RabbitConfig;
-import com.diagbot.entity.SysLog;
-import com.diagbot.service.LoggerService;
-import org.springframework.amqp.core.AmqpTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * @Description: 日志发送方
- * @author: gaodm
- * @time: 2018/8/2 13:51
- */
-@Service
-public class LoggerServiceImpl implements LoggerService {
-
-    @Autowired
-    private AmqpTemplate rabbitTemplate;
-
-    @Override
-    public void log(SysLog sysLog){
-        rabbitTemplate.convertAndSend(RabbitConfig.queueName, JSON.toJSONString(sysLog));
-    }
-}