docta-package 1.2.13 → 1.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/rabbitmq/publisher.js +0 -58
- package/package.json +2 -1
|
@@ -39,61 +39,3 @@ function publishToTopicExchange(_a) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
// import amqp from "amqplib";
|
|
43
|
-
// interface ListenerOptions<T> {
|
|
44
|
-
// exchange: string;
|
|
45
|
-
// queue: string;
|
|
46
|
-
// routingKeys: string[];
|
|
47
|
-
// }
|
|
48
|
-
// export async function listenToQueue<T>({
|
|
49
|
-
// exchange,
|
|
50
|
-
// queue,
|
|
51
|
-
// routingKeys,
|
|
52
|
-
// }: ListenerOptions<T>) {
|
|
53
|
-
// try {
|
|
54
|
-
// const connection = await amqp.connect("amqp://localhost");
|
|
55
|
-
// const channel = await connection.createChannel();
|
|
56
|
-
// await channel.assertExchange(exchange, "topic", { durable: true });
|
|
57
|
-
// await channel.assertQueue(queue, { durable: true });
|
|
58
|
-
// // Bind queue to each routing key
|
|
59
|
-
// for (const key of routingKeys) {
|
|
60
|
-
// await channel.bindQueue(queue, exchange, key);
|
|
61
|
-
// console.log(`✅ Bound queue "${queue}" to routing key "${key}"`);
|
|
62
|
-
// }
|
|
63
|
-
// console.log(
|
|
64
|
-
// `🎧 Listening on "${queue}" for routing keys: [${routingKeys.join(", ")}]`
|
|
65
|
-
// );
|
|
66
|
-
// await channel.consume(
|
|
67
|
-
// queue,
|
|
68
|
-
// (msg) => {
|
|
69
|
-
// if (!msg) return;
|
|
70
|
-
// const routingKey = msg.fields.routingKey;
|
|
71
|
-
// const content = msg.content.toString();
|
|
72
|
-
// try {
|
|
73
|
-
// const data: T = JSON.parse(content);
|
|
74
|
-
// // Handle messages based on routing key
|
|
75
|
-
// switch (routingKey) {
|
|
76
|
-
// case "user.created":
|
|
77
|
-
// console.log("👤 User created:", data);
|
|
78
|
-
// break;
|
|
79
|
-
// case "user.updated":
|
|
80
|
-
// console.log("✏️ User updated:", data);
|
|
81
|
-
// break;
|
|
82
|
-
// case "user.deleted":
|
|
83
|
-
// console.log("🗑️ User deleted:", data);
|
|
84
|
-
// break;
|
|
85
|
-
// default:
|
|
86
|
-
// console.warn("⚠️ Unhandled routing key:", routingKey, data);
|
|
87
|
-
// }
|
|
88
|
-
// channel.ack(msg);
|
|
89
|
-
// } catch (err) {
|
|
90
|
-
// console.error("❌ Failed to process message:", err);
|
|
91
|
-
// channel.nack(msg, false, true);
|
|
92
|
-
// }
|
|
93
|
-
// },
|
|
94
|
-
// { noAck: false }
|
|
95
|
-
// );
|
|
96
|
-
// } catch (error) {
|
|
97
|
-
// console.error("Error setting up listener:", error);
|
|
98
|
-
// }
|
|
99
|
-
// }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docta-package",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"description": "This package will contail all the required files to run the docta micro-service app",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"class-transformer": "^0.5.1",
|
|
36
36
|
"class-validator": "^0.14.2",
|
|
37
37
|
"express": "^5.1.0",
|
|
38
|
+
"jsonwebtoken": "^9.0.2",
|
|
38
39
|
"mongoose": "^8.19.1",
|
|
39
40
|
"multer": "^2.0.2",
|
|
40
41
|
"reflect-metadata": "^0.2.2",
|