diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fe381b4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+/target/
+
+/.idea/
+
+
diff --git a/pom.xml b/pom.xml
index 48fe4bf..c3e92eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,6 +23,25 @@
org.springframework.boot
spring-boot-starter
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ junit
+ junit
+ 4.13.2
+
+
+ org.projectlombok
+ lombok
+ 1.18.26
+
+
+ com.alibaba
+ fastjson
+ 1.2.83
+
org.springframework.boot
spring-boot-starter-amqp
diff --git a/src/main/java/com/cool/mqconsumer/controller/IndexController.java b/src/main/java/com/cool/mqconsumer/controller/IndexController.java
new file mode 100644
index 0000000..46e39ac
--- /dev/null
+++ b/src/main/java/com/cool/mqconsumer/controller/IndexController.java
@@ -0,0 +1,6 @@
+package com.cool.mqconsumer.controller;
+
+
+public class IndexController {
+
+}
diff --git a/src/main/java/com/cool/mqconsumer/entity/Message.java b/src/main/java/com/cool/mqconsumer/entity/Message.java
new file mode 100644
index 0000000..fcc900e
--- /dev/null
+++ b/src/main/java/com/cool/mqconsumer/entity/Message.java
@@ -0,0 +1,13 @@
+package com.cool.mqconsumer.entity;
+
+import lombok.Data;
+
+@Data
+public class Message {
+ private String nickname;
+ private String pic;
+ private String sendTime;
+ private String message;
+
+ private String account;
+}
diff --git a/src/main/java/com/cool/mqconsumer/mq/InformSmsListen.java b/src/main/java/com/cool/mqconsumer/mq/InformSmsListen.java
new file mode 100644
index 0000000..7dbafd5
--- /dev/null
+++ b/src/main/java/com/cool/mqconsumer/mq/InformSmsListen.java
@@ -0,0 +1,27 @@
+package com.cool.mqconsumer.mq;
+
+import com.alibaba.fastjson.JSON;
+import com.cool.mqconsumer.entity.Message;
+import org.springframework.amqp.core.ExchangeTypes;
+import org.springframework.amqp.rabbit.annotation.Exchange;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.QueueBinding;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.stereotype.Service;
+
+@Service
+public class InformSmsListen {
+
+
+ @RabbitListener(bindings = @QueueBinding(
+ value = @Queue(name = "queue_inform_sms"),
+ exchange = @Exchange(name = "exchange_topics_inform", type = ExchangeTypes.TOPIC),
+ key = {"inform.cool.sms.message"}
+ ))
+ public void SmsConsumer(String message) {
+ System.out.println(message);
+ Message message1 = JSON.parseObject(message, Message.class);
+ System.out.println(message1);
+ }
+
+}
diff --git a/src/main/java/com/cool/mqconsumer/service/SmsService.java b/src/main/java/com/cool/mqconsumer/service/SmsService.java
new file mode 100644
index 0000000..9c638f1
--- /dev/null
+++ b/src/main/java/com/cool/mqconsumer/service/SmsService.java
@@ -0,0 +1,10 @@
+package com.cool.mqconsumer.service;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class SmsService {
+
+
+
+}
diff --git a/src/main/java/com/cool/mqconsumer/util/JsonUtils.java b/src/main/java/com/cool/mqconsumer/util/JsonUtils.java
new file mode 100644
index 0000000..ae6838a
--- /dev/null
+++ b/src/main/java/com/cool/mqconsumer/util/JsonUtils.java
@@ -0,0 +1,11 @@
+package com.cool.mqconsumer.util;
+
+public class JsonUtils {
+
+
+// public T jsonToJavaObject(Class clazz){
+//
+// }
+
+
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 3fe2722..425177f 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -3,4 +3,13 @@ server:
spring:
application:
- name: Mq-Consumer
\ No newline at end of file
+ name: Mq-Consumer
+ rabbitmq:
+ host: 119.29.254.99
+ port: 5672
+ username: cool
+ password: cool
+ virtual-host: /
+ listener:
+ simple:
+ prefetch: 1