From 9057d8571f11a552a326fa35fda9b5ec614f5c58 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 23 四月 2024 09:33:09 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
springboot-vue3/src/main/java/com/example/springboot/component/ModuleB.java | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/ModuleB.java b/springboot-vue3/src/main/java/com/example/springboot/component/ModuleB.java
index e4d6b44..25aa925 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/ModuleB.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/ModuleB.java
@@ -2,25 +2,32 @@
import com.rabbitmq.client.*;
+import java.util.HashMap;
+import java.util.Map;
+
public class ModuleB {
- private final static String QUEUE_NAME = "hangzhoumes";
+ private final static String QUEUE_NAME = "hangzhou2";
public static void main(String[] argv) throws Exception {
// 鍒涘缓杩炴帴宸ュ巶
ConnectionFactory factory = new ConnectionFactory();
- factory.setHost("localhost");
+ factory.setHost("10.153.19.150");
+ // factory.setHost("localhost");
try (Connection connection = factory.newConnection();
Channel channel = connection.createChannel()) {
// 澹版槑闃熷垪
- channel.queueDeclare(QUEUE_NAME, false, false, false, null);
+ Map<String, Object> args = new HashMap<>();
+ args.put("x-max-length",10000);
+ channel.queueDeclare(QUEUE_NAME, true, false, false, args);
+
// 鍒涘缓娑堣垂鑰�
DeliverCallback deliverCallback = (consumerTag, delivery) -> {
String receivedMessage = new String(delivery.getBody(), "UTF-8");
System.out.println(" [x] Received '" + receivedMessage + "'");
};
// 寮�濮嬫秷璐规秷鎭�
- channel.basicConsume(QUEUE_NAME, true, deliverCallback, consumerTag -> {
- });
+ channel.basicConsume(QUEUE_NAME, true, deliverCallback, consumerTag -> {
+ });
}
}
}
--
Gitblit v1.8.0