diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index b56304b..435758f 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -12,6 +12,7 @@
spring-boot-drools
spring-boot-xxjob
spring-boot-common
+ spring-boot-rabbitmq
spring-boot
@@ -43,5 +44,10 @@
lombok
provided
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
diff --git a/spring-boot/spring-boot-common/pom.xml b/spring-boot/spring-boot-common/pom.xml
index caf3cc2..9dbc8b1 100644
--- a/spring-boot/spring-boot-common/pom.xml
+++ b/spring-boot/spring-boot-common/pom.xml
@@ -21,10 +21,10 @@
org.springframework.boot
spring-boot-starter
-
-
-
-
+
+
+
+
org.springframework.boot
spring-boot-starter-aop
@@ -33,17 +33,6 @@
org.aspectj
aspectjweaver
-
-
- org.projectlombok
- lombok
- true
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
org.springframework.boot
spring-boot-starter-web
@@ -52,6 +41,11 @@
org.springframework
spring-tx
+
+ org.springframework.boot
+ spring-boot-test
+ test
+
diff --git a/spring-boot/spring-boot-rabbitmq/pom.xml b/spring-boot/spring-boot-rabbitmq/pom.xml
new file mode 100644
index 0000000..86578d9
--- /dev/null
+++ b/spring-boot/spring-boot-rabbitmq/pom.xml
@@ -0,0 +1,31 @@
+
+
+
+ spring-boot
+ com.wyl.example
+ 1.0-SNAPSHOT
+ ../pom.xml
+
+ 4.0.0
+
+ spring-boot-rabbitmq
+
+
+ 1.8
+ 1.8
+
+
+
+ org.springframework.boot
+ spring-boot-starter-amqp
+
+
+ org.springframework.amqp
+ spring-rabbit-test
+ test
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/IBSApplication.java b/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/IBSApplication.java
new file mode 100644
index 0000000..20a0104
--- /dev/null
+++ b/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/IBSApplication.java
@@ -0,0 +1,14 @@
+package com.wyl.spring.rabbitmq;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class IBSApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(IBSApplication.class, args);
+ }
+
+}
+
diff --git a/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/conf/RabbitMQConfig.java b/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/conf/RabbitMQConfig.java
new file mode 100644
index 0000000..fab975a
--- /dev/null
+++ b/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/conf/RabbitMQConfig.java
@@ -0,0 +1,35 @@
+package com.wyl.spring.rabbitmq.conf;
+
+import org.springframework.amqp.core.Binding;
+import org.springframework.amqp.core.BindingBuilder;
+import org.springframework.amqp.core.DirectExchange;
+import org.springframework.amqp.core.Queue;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class RabbitMQConfig {
+
+
+ //配置direct交换机
+ @Bean
+ public DirectExchange directExchange() {
+ return new DirectExchange("exchange.topic.shop.goodscenter.change");
+ }
+
+ //配置direct队列
+ @Bean
+ public Queue directQueue() {
+ return new Queue("wyl.test");
+ }
+
+ //将direct队列绑定到交换机上
+ @Bean
+ public Binding directBinding(Queue directQueue, DirectExchange directExchange) {
+ // 参数 1 为需要绑定的队列
+ // 参数 2 为需要绑定的交换机
+ // 参数 3绑定时的RoutingKey
+ return BindingBuilder.bind(directQueue).to(directExchange).with("route.goodscenter.goods_basic_change");
+ }
+
+}
diff --git a/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/send/SendServiceImpl.java b/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/send/SendServiceImpl.java
new file mode 100644
index 0000000..8af27d0
--- /dev/null
+++ b/spring-boot/spring-boot-rabbitmq/src/main/java/com/wyl/spring/rabbitmq/send/SendServiceImpl.java
@@ -0,0 +1,33 @@
+package com.wyl.spring.rabbitmq.send;
+
+import org.springframework.amqp.core.AmqpTemplate;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * ClassName:SendMessageImpl
+ * Package:com.springboot.rabbitmq.send.service.impl
+ * Description:
+ *
+ * @Date:2021/6/18 10:17
+ * @Author:hm
+ */
+@Service("sendService")
+public class SendServiceImpl {
+
+ @Resource
+ private AmqpTemplate amqpTemplate;
+
+ public void sendDirectMessage(String message) {
+ /**
+ * 发送direct消息
+ * 参数一为交换机名称
+ * 参数二为路由键名称
+ * 参数三为消息
+ */
+ amqpTemplate.convertAndSend("exchange.topic.shop.goodscenter.change", "route.goodscenter.goods_basic_change", message);
+ }
+
+
+}
diff --git a/spring-boot/spring-boot-rabbitmq/src/main/resources/application.properties b/spring-boot/spring-boot-rabbitmq/src/main/resources/application.properties
new file mode 100644
index 0000000..0e5102d
--- /dev/null
+++ b/spring-boot/spring-boot-rabbitmq/src/main/resources/application.properties
@@ -0,0 +1,8 @@
+spring.rabbitmq.host=192.168.3.10
+spring.rabbitmq.username=asura
+spring.rabbitmq.password=asura
+spring.rabbitmq.port=5672
+spring.rabbitmq.listener.simple.acknowledge-mode=MANUAL
+spring.rabbitmq.listener.direct.acknowledge-mode=MANUAL
+spring.rabbitmq.publisher-confirm-type=CORRELATED
+spring.rabbitmq.publisher-returns=true
\ No newline at end of file
diff --git a/spring-boot/spring-boot-rabbitmq/src/test/java/com/wyl/spring/rabbitmq/SpringBootCommonApplicationTests.java b/spring-boot/spring-boot-rabbitmq/src/test/java/com/wyl/spring/rabbitmq/SpringBootCommonApplicationTests.java
new file mode 100644
index 0000000..ce4214b
--- /dev/null
+++ b/spring-boot/spring-boot-rabbitmq/src/test/java/com/wyl/spring/rabbitmq/SpringBootCommonApplicationTests.java
@@ -0,0 +1,18 @@
+package com.wyl.spring.rabbitmq;
+
+import com.wyl.spring.rabbitmq.send.SendServiceImpl;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
+class IBSApplicationTests {
+ @Autowired
+ SendServiceImpl sendService;
+
+ @Test
+ public void test() {
+ sendService.sendDirectMessage("123");
+ }
+
+}