message-brokers 1.8.2 → 1.8.3
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/README.md +5 -0
- package/lib/message-brokers.js +1 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,6 +75,7 @@ db.on("error", (err) => {
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
const messageBrokers = new MessageBrokers(mongoConnectionHolder, "app_name");
|
|
78
|
+
await messageBrokers.init();
|
|
78
79
|
```
|
|
79
80
|
|
|
80
81
|
#### 2. Native Mongodb driver initialization
|
|
@@ -102,6 +103,7 @@ client
|
|
|
102
103
|
.catch((error) => console.error("❌ MongoDB connection failed:", error));
|
|
103
104
|
|
|
104
105
|
const messageBrokers = new MessageBrokers(mongoConnectionHolder, "app_name");
|
|
106
|
+
await messageBrokers.init();
|
|
105
107
|
```
|
|
106
108
|
|
|
107
109
|
## Usage
|
|
@@ -136,4 +138,7 @@ messageBrokers.publishNotificationMessagesLogs(notification_messages_logs);
|
|
|
136
138
|
|
|
137
139
|
// Publish amqp_lab_api_response
|
|
138
140
|
messageBrokers.publishAmqpLabApiResponse(amqp_lab_api_response);
|
|
141
|
+
|
|
142
|
+
// Publish billing_events
|
|
143
|
+
messageBrokers.publishBillingEvents(billing_events);
|
|
139
144
|
```
|
package/lib/message-brokers.js
CHANGED
|
@@ -12,7 +12,7 @@ class MessageBrokers {
|
|
|
12
12
|
this.applicationName = applicationName || "mb_app";
|
|
13
13
|
this._initialized = false;
|
|
14
14
|
}
|
|
15
|
-
async
|
|
15
|
+
async init() {
|
|
16
16
|
if (this._initialized) return;
|
|
17
17
|
try {
|
|
18
18
|
setActiveApplication(this.applicationName);
|
|
@@ -32,7 +32,6 @@ class MessageBrokers {
|
|
|
32
32
|
* @returns
|
|
33
33
|
*/
|
|
34
34
|
async publishHar(har) {
|
|
35
|
-
await this._ensureInitialized();
|
|
36
35
|
const response = await AmqpController.publishMessage(hv_exchange, "har", har);
|
|
37
36
|
return response;
|
|
38
37
|
}
|
|
@@ -43,7 +42,6 @@ class MessageBrokers {
|
|
|
43
42
|
* @returns
|
|
44
43
|
*/
|
|
45
44
|
async publishHarMeta(har_meta) {
|
|
46
|
-
await this._ensureInitialized();
|
|
47
45
|
const response = await AmqpController.publishMessage(hv_exchange, "har_meta", har_meta);
|
|
48
46
|
return response;
|
|
49
47
|
}
|
|
@@ -54,7 +52,6 @@ class MessageBrokers {
|
|
|
54
52
|
* @returns
|
|
55
53
|
*/
|
|
56
54
|
async publishLabApiResponse(lab_api_response) {
|
|
57
|
-
await this._ensureInitialized();
|
|
58
55
|
const response = await AmqpController.publishMessage(hv_exchange, "lab_api_response", lab_api_response, 2);
|
|
59
56
|
return response;
|
|
60
57
|
}
|
|
@@ -65,7 +62,6 @@ class MessageBrokers {
|
|
|
65
62
|
* @returns
|
|
66
63
|
*/
|
|
67
64
|
async publishHarLabApiResponse(harLab_api_response) {
|
|
68
|
-
await this._ensureInitialized();
|
|
69
65
|
const response = await AmqpController.publishMessage(hv_exchange, "har.lab_api_response", harLab_api_response);
|
|
70
66
|
return response;
|
|
71
67
|
}
|
|
@@ -76,7 +72,6 @@ class MessageBrokers {
|
|
|
76
72
|
* @returns
|
|
77
73
|
*/
|
|
78
74
|
async publishPurchaseDetails(purchase_details) {
|
|
79
|
-
await this._ensureInitialized();
|
|
80
75
|
const response = await AmqpController.publishMessage(hv_exchange, "purchase_details", purchase_details);
|
|
81
76
|
return response;
|
|
82
77
|
}
|
|
@@ -87,7 +82,6 @@ class MessageBrokers {
|
|
|
87
82
|
* @returns
|
|
88
83
|
*/
|
|
89
84
|
async publishLabLocationData(lab_location_data) {
|
|
90
|
-
await this._ensureInitialized();
|
|
91
85
|
const response = await AmqpController.publishMessage(hv_exchange, "lab_location_data", lab_location_data);
|
|
92
86
|
return response;
|
|
93
87
|
}
|
|
@@ -98,7 +92,6 @@ class MessageBrokers {
|
|
|
98
92
|
* @returns
|
|
99
93
|
*/
|
|
100
94
|
async publishInputObject(input_object) {
|
|
101
|
-
await this._ensureInitialized();
|
|
102
95
|
const response = await AmqpController.publishMessage(hv_exchange, "input_object", input_object);
|
|
103
96
|
return response;
|
|
104
97
|
}
|
|
@@ -109,7 +102,6 @@ class MessageBrokers {
|
|
|
109
102
|
* @returns
|
|
110
103
|
*/
|
|
111
104
|
async publishHarStub(har_stub) {
|
|
112
|
-
await this._ensureInitialized();
|
|
113
105
|
const response = await AmqpController.publishMessage(hv_exchange, "har_stub", har_stub);
|
|
114
106
|
return response;
|
|
115
107
|
}
|
|
@@ -120,7 +112,6 @@ class MessageBrokers {
|
|
|
120
112
|
* @returns
|
|
121
113
|
*/
|
|
122
114
|
async publishTrendingData(trending_data) {
|
|
123
|
-
await this._ensureInitialized();
|
|
124
115
|
const response = await AmqpController.publishMessage(hv_exchange, "trending_data", trending_data);
|
|
125
116
|
return response;
|
|
126
117
|
}
|
|
@@ -131,7 +122,6 @@ class MessageBrokers {
|
|
|
131
122
|
* @returns
|
|
132
123
|
*/
|
|
133
124
|
async publishRawQueue(raw_queue) {
|
|
134
|
-
await this._ensureInitialized();
|
|
135
125
|
const response = await AmqpController.publishMessage(hv_exchange, "raw_queue", raw_queue);
|
|
136
126
|
return response;
|
|
137
127
|
}
|
|
@@ -142,7 +132,6 @@ class MessageBrokers {
|
|
|
142
132
|
* @returns
|
|
143
133
|
*/
|
|
144
134
|
async publishNotificationMessagesLogs(notification_messages_logs) {
|
|
145
|
-
await this._ensureInitialized();
|
|
146
135
|
const response = await AmqpController.publishMessage(hv_exchange, "notification_messages_logs", notification_messages_logs);
|
|
147
136
|
return response;
|
|
148
137
|
}
|
|
@@ -153,7 +142,6 @@ class MessageBrokers {
|
|
|
153
142
|
* @returns
|
|
154
143
|
*/
|
|
155
144
|
async publishAmqpLabApiResponse(amqp_lab_api_response) {
|
|
156
|
-
await this._ensureInitialized();
|
|
157
145
|
const response = await AmqpController.publishMessage(hv_exchange, "lab_api_response.amqp", amqp_lab_api_response);
|
|
158
146
|
return response;
|
|
159
147
|
}
|
|
@@ -164,12 +152,10 @@ class MessageBrokers {
|
|
|
164
152
|
* @returns
|
|
165
153
|
*/
|
|
166
154
|
async publishBillingEvents(billing_events) {
|
|
167
|
-
await this._ensureInitialized();
|
|
168
155
|
const response = await AmqpController.publishMessage(hv_exchange, "billing", billing_events);
|
|
169
156
|
return response;
|
|
170
157
|
}
|
|
171
158
|
async publishPendingMessageInCache() {
|
|
172
|
-
await this._ensureInitialized();
|
|
173
159
|
return await AmqpController.publishPendingMessageInCache();
|
|
174
160
|
}
|
|
175
161
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "message-brokers",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "This package contains functions to publish the messages into the message brokers like rabbitmq.",
|
|
5
5
|
"main": "lib/message-brokers.js",
|
|
6
6
|
"types": "lib/types/message-brokers.d.ts",
|