|
|
@@ -48,9 +48,9 @@ const app = (0, express_1.default)();
|
|
|
const port = process.env.EVENT_PORT ? parseInt(process.env.EVENT_PORT, 10) : 3001; // Event API 监听端口,默认为 3001
|
|
|
// RabbitMQ Configuration
|
|
|
const RABBITMQ_URL = process.env.RABBITMQ_URL || "amqp://coloring:coloring123.@localhost:5672";
|
|
|
-const RABBITMQ_EXCHANGE_NAME = process.env.RABBITMQ_EXCHANGE || "event_exchange"; // <-- 从环境变量读取交换机名称
|
|
|
+const RABBITMQ_EXCHANGE_NAME = process.env.RABBITMQ_EXCHANGE || "event-exchange"; // <-- 从环境变量读取交换机名称
|
|
|
const RABBITMQ_LOG_QUEUE = process.env.RABBITMQ_LOG_QUEUE || "log-event-queue"; // <-- 从环境变量读取日志队列名称
|
|
|
-const RABBITMQ_OMS_QUEUE = process.env.RABBITMQ_OMS_QUEUE || "oms_event_queue"; // <-- 从环境变量读取摄取器队列名称
|
|
|
+const RABBITMQ_OMS_QUEUE = process.env.RABBITMQ_OMS_QUEUE || "oms-event-queue"; // <-- 从环境变量读取摄取器队列名称
|
|
|
let amqpConnection;
|
|
|
let amqpChannel;
|
|
|
// --- Initialize RabbitMQ Connection and Channel ---
|
|
|
@@ -130,8 +130,7 @@ const eventHandler = async (req, res) => {
|
|
|
// persistent: true ensures the message survives RabbitMQ restarts
|
|
|
// '' as routing key for fanout exchange means it goes to all bound queues
|
|
|
const published = amqpChannel.publish(RABBITMQ_EXCHANGE_NAME, "", // Routing key (ignored by fanout exchange)
|
|
|
- Buffer.from(message), { persistent: true } // Mark message as persistent
|
|
|
- );
|
|
|
+ Buffer.from(message), { persistent: true });
|
|
|
if (published) {
|
|
|
// console.log('[Event API] Event published to RabbitMQ:', eventData); // Commented for high volume
|
|
|
res.status(200).json({ msg: "ok" });
|