@eratu/common 1.0.1 → 1.0.2
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.
|
@@ -27,21 +27,11 @@ class Listener {
|
|
|
27
27
|
}
|
|
28
28
|
ensureStreamAndConsumer() {
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
//
|
|
31
|
-
try {
|
|
32
|
-
yield this.jsm.streams.info(this.stream);
|
|
33
|
-
}
|
|
34
|
-
catch (_a) {
|
|
35
|
-
yield this.jsm.streams.add({
|
|
36
|
-
name: this.stream,
|
|
37
|
-
subjects: [this.subject],
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
// 2. Ensure durable consumer exists
|
|
30
|
+
// Ensure durable consumer exists
|
|
41
31
|
try {
|
|
42
32
|
yield this.jsm.consumers.info(this.stream, this.durableName);
|
|
43
33
|
}
|
|
44
|
-
catch (
|
|
34
|
+
catch (_a) {
|
|
45
35
|
yield this.jsm.consumers.add(this.stream, {
|
|
46
36
|
durable_name: this.durableName,
|
|
47
37
|
ack_policy: nats_1.AckPolicy.Explicit,
|
|
@@ -49,7 +39,7 @@ class Listener {
|
|
|
49
39
|
filter_subject: this.subject,
|
|
50
40
|
});
|
|
51
41
|
}
|
|
52
|
-
//
|
|
42
|
+
// Get the consumer object
|
|
53
43
|
this.consumer = yield this.js.consumers.get(this.stream, this.durableName);
|
|
54
44
|
});
|
|
55
45
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Streams = void 0;
|
|
4
|
+
var Streams;
|
|
5
|
+
(function (Streams) {
|
|
6
|
+
Streams["OrderServiceStream"] = "orders";
|
|
7
|
+
Streams["BookServiceStream"] = "books";
|
|
8
|
+
Streams["UserServiceStream"] = "users";
|
|
9
|
+
})(Streams || (exports.Streams = Streams = {}));
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -23,3 +23,4 @@ __exportStar(require("./errors/request-validation-error"), exports);
|
|
|
23
23
|
__exportStar(require("./events/base-listener"), exports);
|
|
24
24
|
__exportStar(require("./events/book-created-event"), exports);
|
|
25
25
|
__exportStar(require("./events/subjects"), exports);
|
|
26
|
+
__exportStar(require("./events/streams"), exports);
|