@munlib/common 1.0.52 → 1.0.55
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Channel } from "amqplib";
|
|
1
|
+
import { Channel, ConsumeMessage } from "amqplib";
|
|
2
2
|
import { ExchangeNames, ExchangeTypes, QueueNames, RoutingKeys } from "./subjects";
|
|
3
3
|
interface Event {
|
|
4
4
|
exchangeName: ExchangeNames;
|
|
@@ -13,7 +13,7 @@ export declare abstract class Listener<T extends Event> {
|
|
|
13
13
|
protected queueName: T["queueName"];
|
|
14
14
|
protected routingKey: T["routingKey"];
|
|
15
15
|
protected channel: Channel;
|
|
16
|
-
abstract onMessage(data: T["data"]): void;
|
|
16
|
+
abstract onMessage(data: T["data"], msg: ConsumeMessage): void;
|
|
17
17
|
constructor(channel: Channel, exchangeName: ExchangeNames, exchangeType: ExchangeTypes, queueName: QueueNames, routingKey: RoutingKeys);
|
|
18
18
|
listen(): Promise<void>;
|
|
19
19
|
parseMessage(msg: any): any;
|
|
@@ -64,7 +64,7 @@ var Listener = /** @class */ (function () {
|
|
|
64
64
|
this.channel.consume(this.queueName, function (msg) {
|
|
65
65
|
if (msg) {
|
|
66
66
|
var parsedData = _this.parseMessage(msg);
|
|
67
|
-
_this.onMessage(parsedData);
|
|
67
|
+
_this.onMessage(parsedData, msg);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
return [2 /*return*/];
|
|
@@ -5,7 +5,8 @@ export declare enum RoutingKeys {
|
|
|
5
5
|
OrderCreated = "order:created",
|
|
6
6
|
OrderUpdated = "order:updated",
|
|
7
7
|
ExpirationCompleted = "expiration:completed",
|
|
8
|
-
PaymentCreated = "payment:created"
|
|
8
|
+
PaymentCreated = "payment:created",
|
|
9
|
+
Empty = ""
|
|
9
10
|
}
|
|
10
11
|
export declare enum ExchangeNames {
|
|
11
12
|
exchangeName = "billetera:bus"
|
package/build/events/subjects.js
CHANGED
|
@@ -10,6 +10,7 @@ var RoutingKeys;
|
|
|
10
10
|
RoutingKeys["OrderUpdated"] = "order:updated";
|
|
11
11
|
RoutingKeys["ExpirationCompleted"] = "expiration:completed";
|
|
12
12
|
RoutingKeys["PaymentCreated"] = "payment:created";
|
|
13
|
+
RoutingKeys["Empty"] = "";
|
|
13
14
|
})(RoutingKeys || (exports.RoutingKeys = RoutingKeys = {}));
|
|
14
15
|
var ExchangeNames;
|
|
15
16
|
(function (ExchangeNames) {
|