Ver Fonte

Rabbit MQ

wfansh há 5 meses atrás
pai
commit
ab8a69ed83

+ 56 - 52
jeecg-module-system/jeecg-system-biz/pom.xml

@@ -1,62 +1,66 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
 <project xmlns="http://maven.apache.org/POM/4.0.0"
-		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<parent>
-		<groupId>org.jeecgframework.boot</groupId>
-		<artifactId>jeecg-module-system</artifactId>
-		<version>3.7.0</version>
-	</parent>
-	<modelVersion>4.0.0</modelVersion>
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.jeecgframework.boot</groupId>
+        <artifactId>jeecg-module-system</artifactId>
+        <version>3.7.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
 
 
-	<artifactId>jeecg-system-biz</artifactId>
+    <artifactId>jeecg-system-biz</artifactId>
 
 
-	<dependencies>
-		<dependency>
-			<groupId>org.jeecgframework.boot</groupId>
-			<artifactId>jeecg-system-local-api</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.hibernate</groupId>
-			<artifactId>hibernate-core</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.jeecgframework.boot3</groupId>
-			<artifactId>hibernate-re</artifactId>
-		</dependency>
+    <dependencies>
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-system-local-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jeecgframework.boot3</groupId>
+            <artifactId>hibernate-re</artifactId>
+        </dependency>
 
 
-		<!-- 企业微信/钉钉 api -->
-		<dependency>
-			<groupId>org.jeecgframework</groupId>
-			<artifactId>jeewx-api</artifactId>
-		</dependency>
-		<!-- 积木报表 -->
-		<dependency>
-			<groupId>org.jeecgframework.jimureport</groupId>
-			<artifactId>jimureport-spring-boot3-starter-fastjson2</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.jeecgframework.jimureport</groupId>
-			<artifactId>drag-free-springboot3</artifactId>
-			<version>1.1.2</version>
-		</dependency>
-		<dependency>
-			<groupId>cn.hutool</groupId>
-			<artifactId>hutool-all</artifactId>
-			<version>5.8.25</version>
-		</dependency>
-	<!-- 积木报表 mongo redis 支持包 
-		<dependency>
-			<groupId>org.jeecgframework.jimureport</groupId>
-			<artifactId>jimureport-nosql-starter</artifactId>
-		</dependency>-->
+        <!-- 企业微信/钉钉 api -->
+        <dependency>
+            <groupId>org.jeecgframework</groupId>
+            <artifactId>jeewx-api</artifactId>
+        </dependency>
+        <!-- 积木报表 -->
+        <dependency>
+            <groupId>org.jeecgframework.jimureport</groupId>
+            <artifactId>jimureport-spring-boot3-starter-fastjson2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jeecgframework.jimureport</groupId>
+            <artifactId>drag-free-springboot3</artifactId>
+            <version>1.1.2</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.8.25</version>
+        </dependency>
+        <!-- 积木报表 mongo redis 支持包
+            <dependency>
+                <groupId>org.jeecgframework.jimureport</groupId>
+                <artifactId>jimureport-nosql-starter</artifactId>
+            </dependency>-->
 
 
         <!--xxl-job定时任务-->
         <!--xxl-job定时任务-->
         <dependency>
         <dependency>
-            <groupId>com.xuxueli</groupId>
-            <artifactId>xxl-job-core</artifactId>
-            <version>${xxl-job-core.version}</version>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-boot-starter3-job</artifactId>
+        </dependency>
+
+        <!--rabbitmq消息队列-->
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-boot-starter3-rabbitmq</artifactId>
         </dependency>
         </dependency>
+    </dependencies>
 
 
-	</dependencies>
-	
 </project>
 </project>

+ 16 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/EnquiryDTO.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.adweb.enquiry.dto;
+
+import lombok.Data;
+
+/**
+ * @author wfansh
+ */
+@Data
+public class EnquiryDTO {
+
+    private long id;
+
+    private String msg;
+
+    // TODO
+}

+ 43 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mq/EnquiryReceiver.java

@@ -0,0 +1,43 @@
+package org.jeecg.modules.adweb.enquiry.mq;
+
+import com.rabbitmq.client.Channel;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
+import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
+import org.jeecg.common.annotation.RabbitComponent;
+import org.jeecg.modules.adweb.enquiry.dto.EnquiryDTO;
+import org.springframework.amqp.rabbit.annotation.RabbitHandler;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.amqp.support.AmqpHeaders;
+import org.springframework.messaging.handler.annotation.Header;
+
+/**
+ * Rabbit MQ - 询盘消息接收
+ *
+ * @author wfansh
+ */
+@Slf4j
+@RabbitComponent(value = "enquiryReceiver")
+public class EnquiryReceiver extends BaseRabbiMqHandler<EnquiryDTO> {
+
+    @RabbitHandler
+    @RabbitListener(queues = "enquiry")
+    public void onMessage(
+            EnquiryDTO enquiryDTO,
+            Channel channel,
+            @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
+        super.onMessage(
+                enquiryDTO,
+                deliveryTag,
+                channel,
+                new MqListener<EnquiryDTO>() {
+                    @Override
+                    public void handler(EnquiryDTO enquiry, Channel channel) {
+                        // 业务处理
+                        log.info("收到MQ消息 {}", enquiry);
+                    }
+                });
+    }
+}

+ 0 - 12
jeecg-module-system/jeecg-system-start/pom.xml

@@ -42,18 +42,6 @@
             <groupId>jakarta.servlet</groupId>
             <groupId>jakarta.servlet</groupId>
             <artifactId>jakarta.servlet-api</artifactId>
             <artifactId>jakarta.servlet-api</artifactId>
         </dependency>
         </dependency>
-
-        <!--xxl-job定时任务-->
-        <dependency>
-            <groupId>org.jeecgframework.boot</groupId>
-            <artifactId>jeecg-boot-starter3-job</artifactId>
-        </dependency>
-
-        <!--rabbitmq消息队列-->
-        <dependency>
-            <groupId>org.jeecgframework.boot</groupId>
-            <artifactId>jeecg-boot-starter3-rabbitmq</artifactId>
-        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

+ 2 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -189,9 +189,9 @@ spring:
     username: admin
     username: admin
     password: Initial0
     password: Initial0
     port: 5672
     port: 5672
-    publisher-confirms: true
+    publisher-confirm-type: correlated
     publisher-returns: true
     publisher-returns: true
-    virtual-host: /adweb
+    virtual-host: /adweb3
     listener:
     listener:
       simple:
       simple:
         acknowledge-mode: manual
         acknowledge-mode: manual

+ 2 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml

@@ -189,9 +189,9 @@ spring:
     username: admin
     username: admin
     password: Initial0
     password: Initial0
     port: 5672
     port: 5672
-    publisher-confirms: true
+    publisher-confirm-type: correlated
     publisher-returns: true
     publisher-returns: true
-    virtual-host: /adweb
+    virtual-host: /adweb3
     listener:
     listener:
       simple:
       simple:
         acknowledge-mode: manual
         acknowledge-mode: manual

+ 2 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml

@@ -188,9 +188,9 @@ spring:
     username: admin
     username: admin
     password: Initial0
     password: Initial0
     port: 5672
     port: 5672
-    publisher-confirms: true
+    publisher-confirm-type: correlated
     publisher-returns: true
     publisher-returns: true
-    virtual-host: /adweb
+    virtual-host: /adweb3
     listener:
     listener:
       simple:
       simple:
         acknowledge-mode: manual
         acknowledge-mode: manual