@opra/rabbitmq 1.10.0 → 1.11.1
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/cjs/rabbitmq-adapter.js
CHANGED
|
@@ -127,7 +127,7 @@ class RabbitmqAdapter extends core_1.PlatformAdapter {
|
|
|
127
127
|
return;
|
|
128
128
|
await this.emitAsync('message', msg).catch(() => undefined);
|
|
129
129
|
try {
|
|
130
|
-
await args.handler(msg);
|
|
130
|
+
await args.handler(topic, msg);
|
|
131
131
|
// channel.ack(msg);
|
|
132
132
|
}
|
|
133
133
|
catch (e) {
|
|
@@ -152,11 +152,6 @@ class RabbitmqAdapter extends core_1.PlatformAdapter {
|
|
|
152
152
|
throw e;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
// protected async _connect() {
|
|
156
|
-
// if (!this._connection)
|
|
157
|
-
// this._connection = await amqplib.connect(this._config.connection);
|
|
158
|
-
// return this._connection;
|
|
159
|
-
// }
|
|
160
155
|
/**
|
|
161
156
|
* Closes all connections and stops the service
|
|
162
157
|
*/
|
|
@@ -230,7 +225,7 @@ class RabbitmqAdapter extends core_1.PlatformAdapter {
|
|
|
230
225
|
this[core_1.kAssetCache].set(header, 'decode', decode);
|
|
231
226
|
}
|
|
232
227
|
});
|
|
233
|
-
args.handler = async (message) => {
|
|
228
|
+
args.handler = async (queue, message) => {
|
|
234
229
|
if (!message)
|
|
235
230
|
return;
|
|
236
231
|
const operationHandler = instance[operation.name];
|
|
@@ -266,6 +261,7 @@ class RabbitmqAdapter extends core_1.PlatformAdapter {
|
|
|
266
261
|
controllerInstance: instance,
|
|
267
262
|
operation,
|
|
268
263
|
operationHandler,
|
|
264
|
+
queue,
|
|
269
265
|
fields: message.fields,
|
|
270
266
|
properties: message.properties,
|
|
271
267
|
content,
|
package/cjs/rabbitmq-context.js
CHANGED
|
@@ -29,6 +29,7 @@ class RabbitmqContext extends core_1.ExecutionContext {
|
|
|
29
29
|
this.operation = init.operation;
|
|
30
30
|
if (init.operationHandler)
|
|
31
31
|
this.operationHandler = init.operationHandler;
|
|
32
|
+
this.queue = init.queue;
|
|
32
33
|
this.fields = init.fields;
|
|
33
34
|
this.properties = init.properties;
|
|
34
35
|
this.headers = init.headers || {};
|
package/esm/rabbitmq-adapter.js
CHANGED
|
@@ -123,7 +123,7 @@ export class RabbitmqAdapter extends PlatformAdapter {
|
|
|
123
123
|
return;
|
|
124
124
|
await this.emitAsync('message', msg).catch(() => undefined);
|
|
125
125
|
try {
|
|
126
|
-
await args.handler(msg);
|
|
126
|
+
await args.handler(topic, msg);
|
|
127
127
|
// channel.ack(msg);
|
|
128
128
|
}
|
|
129
129
|
catch (e) {
|
|
@@ -148,11 +148,6 @@ export class RabbitmqAdapter extends PlatformAdapter {
|
|
|
148
148
|
throw e;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
// protected async _connect() {
|
|
152
|
-
// if (!this._connection)
|
|
153
|
-
// this._connection = await amqplib.connect(this._config.connection);
|
|
154
|
-
// return this._connection;
|
|
155
|
-
// }
|
|
156
151
|
/**
|
|
157
152
|
* Closes all connections and stops the service
|
|
158
153
|
*/
|
|
@@ -226,7 +221,7 @@ export class RabbitmqAdapter extends PlatformAdapter {
|
|
|
226
221
|
this[kAssetCache].set(header, 'decode', decode);
|
|
227
222
|
}
|
|
228
223
|
});
|
|
229
|
-
args.handler = async (message) => {
|
|
224
|
+
args.handler = async (queue, message) => {
|
|
230
225
|
if (!message)
|
|
231
226
|
return;
|
|
232
227
|
const operationHandler = instance[operation.name];
|
|
@@ -262,6 +257,7 @@ export class RabbitmqAdapter extends PlatformAdapter {
|
|
|
262
257
|
controllerInstance: instance,
|
|
263
258
|
operation,
|
|
264
259
|
operationHandler,
|
|
260
|
+
queue,
|
|
265
261
|
fields: message.fields,
|
|
266
262
|
properties: message.properties,
|
|
267
263
|
content,
|
package/esm/rabbitmq-context.js
CHANGED
|
@@ -26,6 +26,7 @@ export class RabbitmqContext extends ExecutionContext {
|
|
|
26
26
|
this.operation = init.operation;
|
|
27
27
|
if (init.operationHandler)
|
|
28
28
|
this.operationHandler = init.operationHandler;
|
|
29
|
+
this.queue = init.queue;
|
|
29
30
|
this.fields = init.fields;
|
|
30
31
|
this.properties = init.properties;
|
|
31
32
|
this.headers = init.headers || {};
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/rabbitmq",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Opra RabbitMQ package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@browsery/type-is": "^1.6.18-r8",
|
|
9
|
-
"@opra/common": "^1.10.0",
|
|
10
|
-
"@opra/core": "^1.10.0",
|
|
11
9
|
"content-type": "^1.0.5",
|
|
12
10
|
"iconv-lite": "^0.6.3",
|
|
13
11
|
"node-events-async": "^1.0.0",
|
|
@@ -15,6 +13,8 @@
|
|
|
15
13
|
"valgen": "^5.13.0"
|
|
16
14
|
},
|
|
17
15
|
"peerDependencies": {
|
|
16
|
+
"@opra/common": "^1.11.1",
|
|
17
|
+
"@opra/core": "^1.11.1",
|
|
18
18
|
"amqplib": "^0.10.5"
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
@@ -12,7 +12,7 @@ interface HandlerArguments {
|
|
|
12
12
|
instance: any;
|
|
13
13
|
operation: RpcOperation;
|
|
14
14
|
operationConfig: OperationConfig;
|
|
15
|
-
handler: (msg: ConsumeMessage | null) => void | Promise<void>;
|
|
15
|
+
handler: (queue: string, msg: ConsumeMessage | null) => void | Promise<void>;
|
|
16
16
|
topics: string[];
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
@@ -15,6 +15,7 @@ export declare class RabbitmqContext extends ExecutionContext implements AsyncEv
|
|
|
15
15
|
readonly controllerInstance?: any;
|
|
16
16
|
readonly operation?: RpcOperation;
|
|
17
17
|
readonly operationHandler?: Function;
|
|
18
|
+
readonly queue: string;
|
|
18
19
|
readonly fields: amqplib.MessageFields;
|
|
19
20
|
readonly properties: amqplib.MessageProperties;
|
|
20
21
|
readonly content: any;
|
|
@@ -34,6 +35,7 @@ export declare namespace RabbitmqContext {
|
|
|
34
35
|
operationHandler?: Function;
|
|
35
36
|
content: any;
|
|
36
37
|
headers: Record<string, any>;
|
|
38
|
+
queue: string;
|
|
37
39
|
fields: amqplib.MessageFields;
|
|
38
40
|
properties: amqplib.MessageProperties;
|
|
39
41
|
}
|